If you want to dynamically grow portions inside the document, use mail merge with regions. To specify a mail merge region in the document you need to insert two mail merge fields to mark the beginning and end of the mail merge region. All document content that is included inside a mail merge region automatically will be repeated for every record in the data source (in most cases this is a table).
To mark the beginning of a mail merge region, insert a MERGEFIELD with the name TableStart:MyTable, where MyTable corresponds to the name of the table. To mark the end of the mail merge region insert another MERGEFIELD with the name TableEnd:MyTable. Between these marking fields, place merge fields that correspond to the fields of your data source (table columns). These merge fields will be populated with data from the first row of the data source, then the whole region will be repeated, and the new fields will be populated with data from the second row, and so on.
Follow these simple rules when marking a region:
- TableStart and TableEnd fields must be inside the same section in the document.
- If used inside a table, TableStart and TableEnd must be inside the same row in the table.
- Mail merge regions cannot be nested inside each other and they should be well formed (there is always a pair of matching TableStart and TableEnd with the same table name).
As an example, have a look at the Product Catalog demo. Here is a fragment of a region prepared for mail merge:
You can see a mail merge region defined for populating with data from the Products table. Note that both the marking fields TableStart:Products and TableEnd:Products are placed inside the same row of the Word table.
After executing the mail merge, here is the result: