How to repeat a section in a template

We have a need to build a word template which basically produces a catalogue of images and descriptions, where there are 4 items across (item = image above the description), 3 down the page, and then repeat for however many items there are.
I can’t use TableStart and TableEnd as they put each item on a new line.
Do you have any suggestions? (I’ve attached an image of the type of layout we want)
layout.PNG (34.9 KB)


Thanks for your inquiry. In your case, you need to create the template document with MERGEFIELD and NEXT fields. Please check the attached sample template. (9.8 KB). Hope this helps you.

We suggest you please read the following articles.
About Mail Merge
How to Execute Mail Merge

That only works if I know I have a template with a cell for each result.
What if I do not know the number of results in advance?
Your layout implies I need to create a table with a cell for each result, which implies I know how many results I have at the time I set up my template.


Thanks for your inquiry. Please share your data source in the form of XML along with your expected output Word document. Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output to be generated like. We will then provide you with more information on this along with code.

template_v1 (1).zip (2.1 MB)
In the attached zip file are three files:
1 - dataset.xml is dataset we use. You will see various elements, but in this example we only care about Property elements.
2 - template_v1 (1).doc is the layout we are aiming to achieve - ignore page 1, 2 and 4 - they are static content
3 - is how we thought to start the mail merge template, but can’t see how we would wrap after 4 elements.


Thanks for sharing the detail. We have modified the template document according to your requirement and attached it with this post. modified (13.4 KB)

In this template, we have added a table with one row that has four cells. In the last three cells, we added the NEXT field. Hope this helps you.

thank you so much