MailMerge with DataTable

Hi,
I am trying to populate table in word doc from dataTable. I have created region and have created few merge fields as follows:
«TableStart:Equipment»«NumComponents»«12»«3»«5»«TableEnd:Equipment»
Table is named Equipment and it has 9 records. My doc opens but each page has one records in it i.e. I get 9 page doc. Also I see «TableStart:Equipment» and «TableEnd:Equipment» in document which means something messed up but couldn’t figure out what. Here is my code to merge and open doc.

FileName = SetFileName(DocumentLibraryConstants.ScopeOfWork, "doc");
Document doc = new Document(System.IO.Path.Combine(Server.MapPath("../DocumentTemplates"), FileName));
DataTable dt = TEGGBusiness.SystemComponent.GetComponentsForSalesBuilderReport(CurrentUser.LanguageID, 102885, 2, 1);
dt.TableName = "Equipment";
doc.MailMerge.Execute(dt);
doc.Save(FileName, SaveFormat.Doc, Aspose.Words.SaveType.OpenInWord, Response);

Attached is my doc template, it is not complete since I am doing testing first. Appreciate if you can show some guidance.
Madhu

This message was posted using Page2Forum (attachment) from Product Catalog - Aspose.Words Demos

Hi
Thanks for your request. You should use ExecuteWithRegions method in this case instead Execute method. Please see the following link for more information:
https://docs.aspose.com/words/net/types-of-mail-merge-operations/
Best regards.