The table of contents element can be used to list entries that are part of mail merge templates and in particular in dynamic merge blocks that are generated with data from JSON data or business objects.

MailMerge Template

Consider the following template that contains the title page with a table of contents element that should include all entries with the style name Heading.

TX Text Control and TOC

On the second page, there is a repeating merge block that uses the selected style Heading. For each entry of this merge block in the final document, an entry should be available in the table of contents.

TX Text Control and TOC

Update TOC

After the document has been merged using the MailMerge TX Text Control .NET Server for ASP.NET
DocumentServer Namespace
MailMerge Class
The MailMerge class is a .NET component that can be used to effortlessly merge template documents with database content in .NET projects, such as ASP.NET web applications, web services or Windows services.
class, the TableOfContents TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
TableOfContents Class
A TableOfContents object defines the position and the properties of a table of contents.
objects must be updated using the Update TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
TableOfContents Class
Update Method
Updates the content and the page numbers of the table of contents.
method.

Loading...

After the table of contents have been updated, two entries are shown from the repeated merge blocks on page 2 and 3:

TX Text Control and TOC

Download Samples

The templates from this article and the data source can be downloaded for your own tests using TX Text Control.

Download Sample Templates

For your own tests, you can download a set of sample templates and a JSON data file.

sample_templates.zip