Using Sub-templates in Text Control Reporting
Using sub-templates is a powerful feature to reuse text parts such as consistent page headers and footers, terms of business or address areas. Those parts can be modified separately without changing them in each and every template. During the merge process, the sub-templates are evaluated separately and inserted into the currently merged template. In Text Control, those sub-templates can contain all elements such as merge fields, repeating blocks or sub-templates itself (don't panic, Text…

Using sub-templates is a powerful feature to reuse text parts such as consistent page headers and footers, terms of business or address areas. Those parts can be modified separately without changing them in each and every template. During the merge process, the sub-templates are evaluated separately and inserted into the currently merged template.

In Text Control, those sub-templates can contain all elements such as merge fields, repeating blocks or sub-templates itself (don't panic, Text Control takes care of potential endless loops).
This tutorial shows how to insert a page header using sub-templates.
-
Open the shipped template designer TX Text Control Words.
Start a design for a header with typical elements that should be displayed in your page header including a company logo and the address details.
-
Important: Create the header design in the main text of the document, not in the header:
-
Save this document and name the file header.docx.
-
Create a new document and choose Edit Header from the Header drop-down button:
-
From the Insert Special Field drop-down button, insert an IncludeText field.
In the opened dialog box, type in the name of the header file created in step 2.
-
From the Select Data Source drop-down button, select Load Sample Database and choose Preview Merge Fields.
If you modify the header.docx template, these changes are applied to all templates where this header is included.
You can download both templates here.
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
This tutorial shows how to use the MailMerge component in an ASP.NET Web application to merge a template with data to create an Adobe PDF document.
New Online Sample: Build your First Report
We published a new online demo that shows how to create a report including preparing data, creating a template to merging them together.
ReportingDocumentationReportingCloud
Create your First Document with ReportingCloud
As part of our new ReportingCloud documentation, we published a guided tutorial that shows how to create a document without programming.
MailMerge: Starting Each Merge Block on a New Page
A merge block is repeated based on the number of matching data rows in the hierarchical data object. The complete merge block is cloned and inserted under the original location in the template.…
Using MailMerge with JSON Data
In the last article, we explained how to create an ASP.NET Web API to merge templates with JSON data in the payload body of an HTTP request. The focus of this article was on the Web API and…