Products Technologies Demo Docs Blog Support Company

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 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.

Using sub-templates in Text Control Reporting

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.

  1. 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.

  2. Important: Create the header design in the main text of the document, not in the header:

    Using sub-templates in Text Control Reporting
  3. Save this document and name the file header.docx.

  4. Create a new document and choose Edit Header from the Header drop-down button:

    Using sub-templates in Text Control Reporting
  5. From the Insert Special Field drop-down button, insert an IncludeText field.

    Using sub-templates in Text Control Reporting

    In the opened dialog box, type in the name of the header file created in step 2.

    Using sub-templates in Text Control Reporting
  6. From the Select Data Source drop-down button, select Load Sample Database and choose Preview Merge Fields.

    Using sub-templates in Text Control Reporting

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.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

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.

See Reporting products

Related Posts

ASP.NETReportingHTML5

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.


ASP.NETReportingTutorial

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.


CloudReportingMail Merge

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.…


ReportingTutorialWeb API

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…