Label Style Mail Merge

Hi, I need to perform a mail merge similar to the way MS Word does with labels so the result would look something like this (assuming I have 10 rows in the data source):

Record 01 Record 02 Record 03 Record 04
Record 05 Record 06 Record 07 Record 08
Record 09 Record 10

I’ve managed to get it “almost” working by using the <> merge field (see attached document).

The problem is when I merge a data source where the number of rows is not a multiple of 4, instead of having some blank cells at the end of the final row, it leaves the merge field in place. So it looks something like this…

Record 01 Record 02 Record 03 Record 04
Record 05 Record 06 Record 07 Record 08
Record 09 Record 10 «ContactListFullName»«Next Record» «ContactListFullName»

The attached document includes an example of a pre-merged table and the result.

What do I need to do to have the final cells appear blank?

Also, if there’s a better way to do this (instead of using <>) please let me know.

Hi David,

Thanks for your inquiry. Please use MailMerge.DeleteFields method to remove mail merge related fields from the document. This method removes MERGEFIELD and NEXT fields from the document.

doc.MailMerge.ExecuteWithRegions(…);
doc.MailMerge.DeleteFields();
doc.Save(MyDir + "Out.docx");

You need to use the NEXT field in your template document to achieve your requirements. Moreover, you may also create the template document as shown in attachment.

Please let us know if you have any more queries.