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

DOCIO - mail merge help

i'm trialling DOCIO and was wondering if you have the vb.net code for the following scenario:

We have hundreds of MS Word Documents with 10 merge fields already setup, these merge fields are placeholders for data stored in SQL Server.

We have a grid which users use to select the records/information they want to merge, unlike your standard mail merge process where only 1 Template is used to merge the data (eg like a letter mailout scenario), we have many Word Template documents. The Word Document File Name is unique and specific, every data row that is to be merge will have this file name. So essentially I need a component to read the records the user has selected, find the Word file on the server and merge the data in the merge fields and perform this process for every record the user has selected, then combined all of the merged documents into 1 Word File for them to either print to hardcopy, view in broswer or they may wish to print to PDF.




3 Replies

BP Bhuvaneswari P Syncfusion Team June 4, 2008 01:30 PM UTC

Hi Jerrym,

Thank you for your interest in Syncfusion products.

Yes, it is possible to merge the selected record from the Grid control to the corresponding template document merge field. Then we can merge those generated document using ImportContent() method.

Here is the sample for your reference:

http://websamples.syncfusion.com//samples/DocIO.Windows/F74222/main.htm


Sample description :
1. Click the any record from the Grid control
2. This will match the corresponding record in the template folder
3. Then it will merge the record field value in the template document fields
4. Goto Step1[For more record selction and merge fields]
5. Now click the button "Merge document"
6. This will merge all the documents in the output folder

Please let try this and let us know this meets your requirement.

Best Regards,
Bhuvana




JM Jerry Monteiro June 4, 2008 10:12 PM UTC

Hi

is there a property in the Mail Merge class to automatically map data fields to the ms word merge field names?

>Hi Jerrym,

Thank you for your interest in Syncfusion products.

Yes, it is possible to merge the selected record from the Grid control to the corresponding template document merge field. Then we can merge those generated document using ImportContent() method.

Here is the sample for your reference:

http://websamples.syncfusion.com//samples/DocIO.Windows/F74222/main.htm


Sample description :
1. Click the any record from the Grid control
2. This will match the corresponding record in the template folder
3. Then it will merge the record field value in the template document fields
4. Goto Step1[For more record selction and merge fields]
5. Now click the button "Merge document"
6. This will merge all the documents in the output folder

Please let try this and let us know this meets your requirement.

Best Regards,
Bhuvana






BP Bhuvaneswari P Syncfusion Team June 5, 2008 12:11 PM UTC

Hi Jerrym,

Thanks for the update.

I am not understand about your requirement. Please let me know if your requirement is one the below cases.

1. Case 1:

Is your intention to automatically map between names of fields in your data source and names of mail merge fields in the document

2. Case 2:

If your intension to map particular field in the document and merge with some value. In that case please use the below code snippet:

WordDocument doc = new WordDocument(@"..\..\mailmerge.doc");
string[] fieldname={"FirstName","SecondName"};
string[] fieldvalues={"John","David"};
doc.MailMerge.Execute(fieldname, fieldvalues);


Sample reference:

http://www.syncfusion.com/development/uploads/MapField_34bcb025.zip


If this is not your case then please update us with more details and template document to understand the issue clearly and provide you an solution.

Best Regards,
Bhuvana



Loader.
Live Chat Icon For mobile
Up arrow icon