Nested foreach block in "Mustache" Template

Hi


I am using Aspose Word v16.4.0.
Is there a possibility to have a nested foreach block in the “mustache” template?

Example (List of phones within an single address entry):
<pre style=“border: 0px; vertical-align: baseline; font-family: Arial, Helvetica, sans-serif, “Courier 10 Pitch”, Courier, monospace; background: rgb(247, 247, 247); color: rgb(34, 34, 34); line-height: 21px; margin-bottom: 0px; padding: 1.5em; text-size-adjust: 140%; font-size: 15px;”>{{#foreach Order}}
{{Number}}
{{#foreach Addresses}}
{{Zip} {{City}} {{Street}}
{{#foreach Phones}}
{{Number}}{{Type}}
{{/foreach Phones}}
{{/foreach Addresses}}
{{/foreach Order}}


Data structure:
 // <-- Current context is here.
23


1234
Foo
Foo Street 123


777 777 777
Fix


666 666 666
Mobile




4312
Bar
Bar Street 131


777 777 777
Fix


666 666 666
Mobile






Thank you for your support.

Regards,
Simon
Hi Simon,

Thanks for your inquiry. Yes, you can use nested foreach block in "Mustache" template. We have modified the xml and template documents and have attached it with this post for your kind reference. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");  
DataSet ds = new DataSet();
ds.readXml(MyDir + "in.xml");

doc.getMailMerge().setUseNonMergeFields(true);
doc.getMailMerge().executeWithRegions(ds);
doc.save(MyDir + "Out v16.11.0.docx");