We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Mail Merge fails to merge if document has section break

I am evaluating the DocIO component and have a mail merge that I got working.  However, as soon as I place a section break in the document(not programactially...just in the doc like a user would).  the mail merge fails to merge any fields.  All the merge fields are wrapped in a TableStart and a TableEnd so it merges for each record in the table.  Take out the section break and it works, put it back and it doesn't.  No errors...just the same document out the other end.

7 Replies

RM Ramkumar M Syncfusion Team November 28, 2012 10:34 AM UTC

Hi Darren,

Thank you for your interest in Syncfusion products.

Currently in DocIO while executing group mail merge operations the group fields must be present within in a single text body. If section break inserted in between TableStart and TableEnd, then group fields will be preserved in separate text bodies cause failure in Mail merging Group. So we recommend that for executing group mailmerge, ensure that the group fields are available within a single text body.

Please let us know if you have any questions

Regards

Ramkumar



DA Darren November 28, 2012 02:50 PM UTC

Ok.  I was able to get it to work by just using Execute and passing the table information.  Perhaps you could throw an exception that provides meaningful message in this case.


RM Ramkumar M Syncfusion Team November 30, 2012 01:03 PM UTC

Hi Darren,

 

Thank you for your update.

 

document.Mailmerge.Execute function performs replacements of every merge field in the document, with the corresponding values  from data source

 

document.Mailmerge.ExceuteGroup function performs replacements of merge fields with in a group marked by TableStart and a TableEnd, for each rows of data source. Hence the mail merge fails if the TableStart and TableEnd presents in different text body.

  

Regarding Exception throw:

As per your suggestion we have planned to through exception for this case in our feature release.

 

Please let us know if you have any question.

 

Regards

Ramkumar



DA Darren December 3, 2012 05:10 PM UTC

In response to your comment... "document.Mailmerge.Execute function performs replacements of every merge field in the document, with the corresponding values  from data source".  This appears not to be true if the merge field is in the page header.  How do I run mail merge data into the page header?


RM Ramkumar M Syncfusion Team December 4, 2012 10:48 AM UTC

Hi Darren, 

Thank you for your update.

We are not able to reproduce the mentioned issue with replacement of merge fields in page Header with corresponding values from data source while calling document.Mailmerge.Execute(dataSource).For your reference please find the sample from the attachment that we have used to reproduce mentioned issue.

Could you please provide us the following?

1) Runnable sample along with input document to reproduce the issue.

2) Details of DocIO version that you are currently using.

So that we can analyze on the exact cause of the issue and provide you the proper solution.

Please let us know if you have any question.

Regards

Ramkumar 



Sample_2e7b773e.zip


DA Darren December 4, 2012 04:23 PM UTC

I have attached a sample that demonstrates both issues.  It fails to merge the field in the header and fails to remove the Next Record fields(it actually outputs them as text...notice the commented Replace code that is my workaround for removing those).  The version being used is 10.204.0.56.  If you look in the bin/debug folder at the TestDocOut.docx, you will see what it generated when I ran it....do this before you try to execute it or it will get overwritten.

Also, I ran the sample you attached and the header fields merged properly.


SyncFusionMailMergeTest_e743a803.zip


RM Ramkumar M Syncfusion Team December 7, 2012 08:49 AM UTC

Hi Darren,

Thank you for your update.

Regarding issue with replacement of merge fields in page Header:

Currently in DocIO while calling document.MailMerge.Execute function we perform mail merge starting from body section of document then header section and then footer sections sequentially.

As you have using the NextRecord field to navigate through each record in data source, once if the data source reaches the end of record while merging fields in body section then mail merge process terminated in body section itself, hence the merge field in the header section not merged.

On analyzing your sample we found that you have used the field “ProgramName” commonly for the entire row. If field “ProgramName” is common for all the row means then you can merge that particular field separately. For your reference we have modified you sample code to illustrate this case. Please find the sample from the attachment and let us know if this helps you


Regarding issue with remove NextRecord field:

Could you please report this issue through Direct Trac Developer Support System (https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents because you can take the advantage of the expertise of a dedicated support engineer and a guaranteed response time and we hope you will take advantage of this system as well. If you have already reported, please ignore this.

Please let us know if you have any other questions.

Regards,
Ramkumar



SyncFusionMailMergeTest_fa1fc74a.zip

Loader.
Live Chat Icon For mobile
Up arrow icon