In version X13 (23.0), we introduced new merge block elements based on the new document element SubTextPart. The old concept using two bookmarks is still compatible and will be converted when loading an old template into the designer TX Text Control Words.
This new concept makes the handling inside the template designer TX Text Control Words more intuitive and fault tolerant which makes it very easy for non-developers to create templates, only with MS Word skills. The merge blocks are highlighted automatically which helps to find the repeating blocks in a template. Nested blocks can be visually distinguished by using different colors or transparency for different block levels.
The following tutorial shows how to insert nested merge blocks using TX Text Control Words and the sample database.
-
Start TX Text Control Words and open the Reports ribbon tab. Select Load Sample Database from the Data Source drop-down button.
-
Select the Sales_SalesOrderDetail table from the Merge Blocks drop-down button.
In the opened dialog box, select the columns OrderQty, UnitPrice and LineTotal, check the check box Add table header row and confirm with OK.
-
Now set the insert position into the first cell of the second row of the created table and choose Insert Below from the Rows & Columns group in the Table Tools contextual ribbon tab. As you can see in the screenshot below, the merge block (visualized through a transparent red overlay) gets extended automatically.
-
Select the second table row and choose Merge Cells from the Merge group.
-
Back in the Reports ribbon tab, choose Production_Product from the Merge Block drop-down button. Select the column Name and confirm with OK. Click on Field Navigation to see the created nested block hierarchy in the tree view:
Nested merge blocks must be added in the order from outside to inside and cannot overlap, but the begin or end positions of 2 or more blocks can be the same.
-
Click Preview Merge Fields to preview the merge results.
The merge fields for the outer block are coming from the table Sales_SalesOrderDetail. The inner block is a table with a direct relation and the fields for the inner block are populated from the data table Production_Product. These relations can be created in the dialog Edit Data Relations: