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

Simple List Mail Merge Syntax

I have a collection of strings that I wish to output to a mail merge document.

Since an item in this list has no child properties, what would be the mail merge syntax to use in the document?

I have tried the following mail merge fields:

<<string_list>>                                                                 outputs System.Collections.Generic.List`1[System.String]
<TableStart:string_list>><TableEnd:string_list>>          no output

1 Reply

PR Poorani Rajendran Syncfusion Team July 19, 2019 12:00 PM UTC

Hi Steve,

Thank you for contacting Syncfusion support. 
<<string_list>> outputs System.Collections.Generic.List`1[System.String] 
To merge the list of strings in the Word document using Mail merge functionality, we suggest you to set the MergeFields in  template Word document and then execute mail merge using  Execute(IEnumerable) API. 
<TableStart:string_list>><TableEnd:string_list>> no output 
To merge of list of string in particular group or table in the Word document, we suggest you to set the MergeFields inside the group and then  execute mail merge using  ExecuteGroup(MailMergeDataTable) API.

In your scenario, there is no MergeFields inside the group (<TableStart:string_list>><TableEnd:string_list>>). So, while executing mail merge functionality using DocIO it doesn’t merge the data into the Word document. 

We have prepared a sample application as per your requirements and it can be download from the below link :

Note: Please find the input Word document template in the “Data” folder of above sample application.
1. “ExecuteTemplate.docx”-Template Word document used to execute mail merge in whole Word document.
2. “ExecuteGroupTemplate.docx”- Template Word document used to execute mail merge for particular group in Word document.

In this sample, we have done following things:
1. Loads the input Word document template.
2. Generate data using the list of string.
3. Executes mail merge in the Word document using  Execute(IEnumerable) API.
4. Executes mail merge for particular group in Word document ExecuteGroup(MailMergeDataTable) API.
5. Saves the Word document.

Please refer the below UG documentation link to know more about working with Mail merge in Word document using DocIO:

Please let us know if you have any other questions.

Poorani Rajendran

Live Chat Icon For mobile
Up arrow icon