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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

item seperator after last item when performing Mail merge for a group

Thread ID:





130970 Jun 14,2017 08:54 AM UTC Jun 15,2017 10:12 AM UTC ASP.NET Web Forms 2
Tags: DocIO
Sebastian Kieritz
Asked On June 14, 2017 09:12 AM UTC

I have a list of persons, and I want to have this list merged into my word document in a way that each person should be placed on a separate line. Assuming my list consists of the persons "Alice" and "Bob", my resulting file could look like " A list of persons: Alice Bob " How would my word file have to look like to allow that? If my file looks like " A list of persons: {MERGEFIELD BeginGroup:Persons}{MERGEFIELD FirstName} {MERGEFIELD EndGroup:Persons} " the result will look like " A list of persons: Alice Bob " Notice the unwanted empty line at the end. On the other hand, if my file looked like "A list of persons: {MERGEFIELD BeginGroup:Persons}{MERGEFIELD FirstName}, {MERGEFIELD EndGroup:Persons}" the result would be "A list of persons: Alice, Bob, " I don't want the "separator" to be applied after the last item as well, just as ",".Join() would apply it to the last item. (Sidenote: After I edited this post to add some information, all newlines vanished (even though they were visible in the editor before saving), which makes the post unreadable and much less comprehensible. Adding them all again doesn't work, so I'm sorry that if something might be incomprehensible.)

Sebastian Kieritz
Replied On June 14, 2017 09:17 AM UTC

This is how my last posting should look like, but I can't format it that way again.

Sethumanikkam Yogendran [Syncfusion]
Replied On June 15, 2017 10:12 AM UTC

Hi Sebastian,

Thank you for contacting Syncfusion support.

Regarding empty line after Mail merge:
To remove empty paragraphs, you can use the “RemoveEmptyParagraphs” and “RemoveEmptyGroup” properties from MailMerge which will remove the paragraphs and groups which contains empty merge field values in Word document while performing Mail merge.

Regarding remove separator for last item while performing the Mail merge:
To remove separator in the group (i.e after merge field), you can use Event support which will allows you to work with merge fields and its owners while performing Mail merge.

We have prepared the sample to illustrate the same, please find the sample from below link and let us know if this helps you.
Sample link
Note: Please find the input template in “App_Data” folder and code snippets in “Default.aspx.cs” file in the application.

Please refer our UG link to know more about Event support in Mail merge.

If we misunderstood any of your requirement, then kindly provide us sample or modified sample of above along with data’s used at your end and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon