MailMerge Problem

Hello,

I must be missing something very basic in this process. Can anyone set me straight? I have created a Word doc with several MergeFields. I would like to create a merged document derived from this "template"document. To this end I am following the outline prescribed in the Aspose Programmer’s Guide(atleast I think I am).

The following code causes a sys.Webforms.PageRequestManagerParserErrorException. …

Error Parsing near '? | ? '. Can anyone tell me what I am missing?

Dave

protected void btnGenerateApose_Click(object sender, EventArgs e)
{
    Document doc = new Document(@"C:\Docs\TermSheet\TermSheet.Doc");
    doc.MailMerge.Execute(new string[] { "OrgName", "OrgAddress1", "OrgAddress2", "OrgCity", "OrgState", "OrgZip", "FirstName", "LastName", "Title" },
    new object[] { "Test Merge Company.", "1111 First St.", "Ste. 1111", "Los Angeles", "CA", "91111", "ContactFirst", "ContactLast", "Owner" });
    doc.Save("TermSheet Out.doc", SaveFormat.Doc, SaveType.OpenInBrowser, Response);
}

Hello

Thanks for your inquiry. Could you please attach your template document here? I will check the issue on my side and provide you more information.

Best regards,

Andrey,

Thanks for the reply. I am a little confused as to the creation of a template. In Word, where this creation takes place, a datasource is required to insert mergefields. I have used “Create a new List” and a txt file as this datasource. Perhaps this is the problem. At any rate I have attached the document which contains only a small bit of text(Attn:) and 9 merge fields, «OrgName»,«OrgAddress1»,«OrgAddress2»,«OrgCity», «OrgState»,«OrgZip»,«FirstName»,«LastName»,«Title».

I would really like to make this work, but am puzzeled at the moment.

Thanks again

Dave

Hi David,

Since you’re having problems inserting merge fields without attaching a data source first, I assume you are using Word 2007, is this correct? This limitation is partly correct in Word 2007. It seems to strict and only allows you to insert merge fields under the mailings tab to after you have attached a data source. You can still insert merge fields without a data source, even though it is found in a rather remote place. Please follow the directions below:

  1. Click on the Insert Tab
  2. Under the section called “Text” you can see a click down menu called “Quick Parts”, click here
  3. Select Field
  4. Scroll down to MergeField,
  5. Fill out the necessary details

You should then be able to insert your merge fields even without a data source. Thank you for pointing this out to us, I will look into making this clearer in the documentation.

You can now remove the text file data source from inside Microsoft Word as you are not actually using it for mail merge, you are using the data specified in your code.

As for the error that occurs, I cannot reproduce the problem on my side. Using your code the merge appears to be successful. You may want to first remove the link to text file database from inside Microsoft Word as this maybe what’s causing the problem. The error does appear to do with the browser so it might be an issue with opening in the browser. You may want to first try to output the document to a file rather than the browser using this code below and see if the error still occurs.

doc.Save("TermSheet Out.doc");

If that is the case then please include your code for Response as well and we will try to sort out the issue.

Thanks,

Thanks Adam, I will start this process now and update the link as to the results.

David

The document saves fine to disk. Thanks. It is a major step. The Parser error remains. Here is how Response is written. My gut response is to override the Browsable attribute and set it to true. But I have never changed metadata and am not really sure of the steps to do this, if in fact my gut level is correct.

I am going home now. There hasn’t been a problem with the time difference throughout this post, so I am in hopes that early tomorrow I can resume this quest.

Thanks again.

David

// Summary:
// Gets the System.Web.HttpResponse object associated with the System.Web.UI.Page
// object. This object allows you to send HTTP response data to a client and
// contains information about that response.
//
// Returns:
// The current System.Web.HttpResponse associated with the page.
//
// Exceptions:
// System.Web.HttpException:
// The System.Web.HttpResponse object is not available.
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public HttpResponse Response { get; }

Hi

Thank you for additional information. I just created a test application using your template and your code. And as I can see, all works fine on my side. I attached the test application here for your reference.

Please try running the test application on your side and let me know how it goes.

Also, parser error might occur because you did not registers .NET framework in IIS. Please try running the following command in Visual Studio command prompt.

aspnet_regiis /i

Best regards,

Thanks for the response. The test application you sent to me runs fine, but when the exact code is dropped into my application, I get the same error if I do not include Response.End (); and an error c00ce514 error if I include Response.End(). So I built a simple page that calls the code and it works in my application until I use my masterpage in the design of the aspx that holds the codebehind for the line of code, doc.Save(“TermSheet Out.doc”, SaveFormat.Doc, SaveType.OpenInBrowser, Response);

Unless this post triggers a immediate solution in your mind, I will redesign my interface to accomodate this phenomenon.

Thank you for all the help you have given me.

David

Hi

Thank you for additional information. Maybe you can create a simple application, which will allow me to reproduce the problem on my side. I will check it and try to help you to resolve the problem.

Best regards,

Andrey,

Once again, thanks for the input. I will build a sample app using the masterpage I employ on my production application and ship it over to you. I have to get what I now have working in development working on my staging environment. The saving of a doc file and a pdf will fulfil the expectations of end users. Document displaying (and perhaps editing) will be GREAT and I look forward to it.

David

Hi

Thank you for additional information, I will wait for your inputs.

Best regards,

I hope this helps.

Attached is a zip containing a stripped down version of my application that attempts 2 things.

  1. Saves the desired file to a location - this is successful.

  2. Opens the document in a browser - this fails error on page icon in the status tray says:

Could not complete the operation due to error c00ce514

Thanks.

David

Hi David,

Thank you for additional information. But I cannot reproduce the problem with your application on my side. The document has been successfully opened without any errors.

Best regards,

I guess that falls in the I’ve got good news and bad news. Have you ever had experience with eroor c00ce514 or any suggestions as possible causes of this error on my machine? I will start to try and untangle this problem as to why my machine, or browser setting or iis setting or whatever is causing a problem.

Thanks

David

Hi David,

All that I know about this error I found in the Internet.

Hope this helps you:
https://nevyan.blogspot.com/2008/12/easy-solve-ajax-c00ce514-error.html

Best regards,

I had looked at this link, no help. Nothing seems to work for me on this issue.

David

Hi David,

Thank you for additional information. I still cannot reproduce the problem on my side. Could you please try using other browser IE or Firefox, and let me know how it goes on your side. It seems it is no specific Aspose problem.

Best regards,

Andrey,

The posted site or anything else found on the web regarding the error message does not help me. I am using IE 7.0 as are all the computers in my company.

I am still frustrated with the open in browser not working on any machine in my company. Please bear with me and try to help me get aspose working in my application. It would be so nice.

The problem seems to happen when I try to open a file “inbrowser” from a webpage that utilizes my masterpage. I have scoured the app and can not find why the xml browser does not work for this function. I may have an explaination as to why it works on you end and not mine…I think I goofed and sent you an example that included a page that does work as well as one that does not work. Perhaps you set the one that does work as the start up file. I am resending the example that does not work on my computer. This time the only aspx in the example(which is named letters.aspx) should be set as the start up page.

If it does work on your end, I do not know what to do. I have really spent a lot of time and effort on this and feel so very close to success and yet so far due to the parser error.

Thanks again for your help.

David

Hi David,

After doing some search on Google, it appears that error appears frequently when using controls in UpdatePanel. Try looking at this link below and see if it helps your problem.
https://social.msdn.microsoft.com/Forums/en-US/cb6ec089-9313-4179-bf7d-546585f9fbe9/could-not-complete-the-operation-due-to-error-c00ce514

Also, it’s a long shot, but you may also want to try explicitly setting the charset and encoding properties for your project as that also seems to be linked to error in some cases.
https://docs.microsoft.com/en-us/previous-versions/39d1w2xf(v=vs.140)

Thanks,

Thank you one and all. I have managed to make this work for me by employing a Request.Redirect to an aspx page that does not contain my MasterPage. I place the document stats in the querystring and am able to view the document.

This seems inelegant, but the feat is accomplished quite nicely, which is the bottom line. When I have more time, I will look into the forum posts dealing with MasterPage problems.

The respectful and informed answers given me on this forum are very much appreciated.

Thanks again

David