Reporting Tutorial: Repeating Blocks with Related Sub Tables
The MailMerge engine in TX Text Control supports master-detail reports through repeating merge blocks. Using TX Text Control Words as the template designer, developers insert merge blocks for related sub tables, embed product images via placeholders, and preview merged output.

Creating product lists or sales reports is a common application for TX Text Control's reporting engine MailMerge. Repeating table rows, where related detail information is listed in sub tables, are typical elements of such reports. The following screenshot illustrates such a list:
Creating those master-detail views is a very easy task using TX Text Control. Master-detail interfaces display a master list and details for the current item. Think of a product list divided into categories where all products are listed in a sub table under the specific category.
This basic tutorial shows how to create such a list based on the sample database that comes with TX Text Control Words - the shipped template designer. At the end of this tutorial, the following template will be created that can be directly tested with the sample database:
-
Open TX Text Control Words. In the Mailings ribbon tab, click the Load Sample Database menu item from the Select Data Source drop-down button.

-
From the Merge Blocks ribbon group, open the Insert Merge Block drop-down button and select Sales_SalesOrderDetail to insert a merge block.

-
In the opened dialog box, select OrderQty, UnitPrice and LineTotal from the available table colums. Check the Add table header row check box and confirm with OK.

-
The following formatted merge block is inserted into the document:

-
Set the input position into the second table row and choose Insert Below from the Rows & Columns ribbon group of the Table Tools contextual ribbon group.

-
Insert a second row, change the background color of the new table rows and indent the first column. Additionally, add column names to the first blue table row.

-
Set the input position into the second row of the blue table rows and choose Sales_SalesOrderDetail from the Insert Merge Field drop-down button.

-
In the opened dialog box, expand the Production_Product node in the tree view, select Name and confirm with Insert Field. This dialog shows all related sub tables and their available field names.
Repeat this step for the next column ProductNumber.
-
Set the input position into the third column of the new blue row and choose Image Placeholder from the Image drop-down button of the Insert ribbon group.

-
Scale down the image placeholder that should fit into the table cell. Right-click the image placeholder and select Sales_SalesOrderDetail from the context menu item Select Object Data Source.

-
In the opened dialog box, expand the nodes until you reach Production_ProductPhoto, select ThumbNailPhoto and confirm with Insert Field.

-
Right-click the image again and set the Text Wrapping to In Line.

-
Choose Preview Merge Fields from the Mailings ribbon tab to start the merge process. In the opended dialog box, confirm the number of preview records with OK.

You can download the sample template and load it into the shipped sample TX Text Control Words.
Try TX Text Control Reporting yourself!
Download the TX Text Control Trial version today.
Or Simply Call Us to Learn More:
+1 704 544 7445 (US) |
+49 421 427067 10 (Europe) |
Reporting
The Text Control Reporting Framework combines powerful reporting features with an easy-to-use, MS Word compatible word processor. Users can create documents and templates using ordinary Microsoft Word skills. The Reporting Framework is included in all .NET based TX Text Control products including ASP.NET, Windows Forms and WPF.
Related Posts
Creating Your First ASP.NET Reporting Application
The MailMerge and ServerTextControl components of TX Text Control .NET Server for ASP.NET enable server-side reporting in Web Forms. A template.docx merges with XML data via a button click…
New Online Sample: Build your First Report
A new interactive online demo walks through building a report with TX Text Control in three steps: preparing JSON data in a live editor, creating a template with merge fields and repeating blocks,…
ReportingDocumentationReportingCloud
Create your First Document with ReportingCloud
ReportingCloud documentation now includes interactive tutorials for creating documents without code. Users enter an API key, choose a format such as PDF or DOCX, customize the merge data payload,…
MailMerge: Starting Each Merge Block on a New Page
Merge blocks in TX Text Control repeat based on matching data rows. Applying ParagraphFormat.PageBreakBefore to the first paragraph of a block forces each repetition onto a new page. Section…
Using MailMerge with JSON Data
Merge document templates with JSON data using TX Text Control MailMerge by converting nested JSON strings into DataSet objects via Newtonsoft.Json. The JSON is first transformed to XML, then…
