I try build template in .doc file. I use mail merge to bind data.
In my template I use field like <<TableStart:ListData>> ... <<TableEnd:ListData>>
to building table. I now how add if statement {IF ="True" ... }
.
But how add foreach loop?
In this page: Mustache syntax is description of mustache syntax with foreach. How add this code to template.docx ?
My c# code - it may be usefull:
var document = GetDocumentFromTemplate("SystemConfigurationTemplate.docx");
var model = BuildModel();
var asposeDataSource = new AsposeDataSource(document, model);
document.MailMerge.Execute(asposeDataSource);
document.Save(stream, SaveFormat.Pdf);
Please paste the following syntax in Word document:
You then need to call MailMerge.ExecuteWithRegions method to see foreach tag in action. Please see following code:
I work with Aspose as Developer Evangelist.