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
close icon

Mail Merge from multiple DataSet

Hi,

I want to generate a Word document from different SQL queries.
I've got X DataSet and I want to inject them in my Word document.

When I try to inject data with this code : 

foreach (DataSet dsQuery in queries)
{
wordDocument.WordDocument.MailMerge.Execute(dsQuery.Tables[0]);
}     

Only my first DataSet has been injected.
How can I do that?

Best regards.

1 Reply

RM Ramkumar M Syncfusion Team November 9, 2012 12:44 PM UTC

Hi Nicolas,

Thank you for your interest in Syncfusion products

Currently in DocIO we have cleared all the merge fields once the Mailmerge.Execute(table) function called. To avoid this please set Mailmerge.ClearFields as false to preserve the remaining mail merge fields once the Mailmerge.Execute(table) function called. For your reference please find the code snippets below.

 

Code snippets:

 

wordDocument. MailMerge.ClearFields = false;

 

foreach (DataSet dsQuery in queries)

   {

     wordDocument.WordDocument.MailMerge.Execute(dsQuery.Tables[0]);

   }  

      

Please let us know if you have any question.

Regards

Ramkumar


Loader.
Live Chat Icon For mobile
Up arrow icon