Aspose.Words for Java - How to create tables in a loop using Mustache in docx templates


we are trying to create several tables in a loop using a docx template with Mustache. The structure is as followed (see attached docx for exact structure):

{{#foreach dataTables}}
Table 1
Table 2
Table 3
Table 4
Table 5
{{/foreach dataTables}}

Judging by Mail Merge Template from Mustache Syntax in C#|Aspose.Words for .NET I think that should be possible. However for this template we are getting the error message “Found start of mail merge region ‘dataTables’ without matching end.”

Any advice on what we are doing wrong in our template would be highly appreciated.

Note: We are using aspose-words jdk16 20.8

template.docx (283.3 KB)

@trippl Most likely you are using Aspose.Words in evaluation mode and your template is truncated at the end. You can check this by opening and saving your document:

Document doc = new Document("C:\\Temp\\template.docx");

You can request a temporary 30-days license to test Aspose.Words without evaluation version limitations.

@alexey.noskov thank you very much. That was indeed the issue. When I set the license everything works fine.

@trippl Please feel free to ask in case of you issues. We will be glad to help you.