Hi Sistemas,
Thank you for contacting Syncfusion support.
We suspect that your requirement is to set bullet list during mail merge execution. In the Word document, bullet list are not text character which are list format applied to each paragraphs. So, to preserve bullet list for particular line, we have to set list format for that paragraph.
To achieve your requirement, we suggest you use any one of below approaches:
Approach 1:
In DocIO, using MergeField event you can access the merge field during mail merge execution. Using that even, you can able to acess the owner paragraph of merge field and apply bullet list format for that paragraph. Please refer the below code example to do the same at your end:
|
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(@"Template.docx", FormatType.Docx);
string[] fieldNames = { "ContactName", "CompanyName" };
string[] fieldValues = { "Nancy", "Syncfusion" };
//Uses the mail merge events to perform the formatting during runtime
wordDocument.MailMerge.MergeField += new MergeFieldEventHandler(ApplyListFormat);
//Performs the mail merge
wordDocument.MailMerge.Execute(fieldNames, fieldValues);
//Saves the Word document
wordDocument.Save("output.docx", FormatType.Docx);
wordDocument.Close();
System.Diagnostics.Process.Start("output.docx"); |
|
private static void ApplyListFormat(object sender, MergeFieldEventArgs args)
{
//Gets the owner paragraph of current merge field.
WParagraph paragraph= args.CurrentMergeField.OwnerParagraph;
//Applies the bullet list style to paragraph
paragraph.ListFormat.ApplyDefBulletStyle();
} |
Approach 2:
Otherwise, you can also prepare the template document with list paragraph (which has merge field). Thereby, it will preserve result with bullet list in the resultant Word document.
Please let us know if you have any other questions.
Regards,
Hemalatha C