Repeatable MailMerge Field


Could you please provide an example of Repeatable Mailmerge field? We get xml file at runtime containing data (table rows). I would like to mailmerge these data in to the word table inside the template. How do I create a repeatable mailmerge field such that rows are added dynamically?



See the Sales Invoice or Product Catalog report in the Aspose.Word.Demos project that is included with the Aspose.Word installer.

Basically you need to define a mail merge region by inserting two extra merge fields with special names: TableStart:MyTableName and TableEnd:MyTableName and then invoke MailMerge.ExecuteWithRegions. In this case the part of the document enclosed between the TableStart and TableEnd fields will repeat for every row in your data source.