We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MailMerge with DataTable

I am trying to populate table in word doc from dataTable. I have created region and have created few merge fields as follows:
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.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.

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

Thanks for your request. You should use ExecuteWithRegions method in this case instead Execute method. Please see the following link for more information:
Best regards.