TX Text Control .NET Documentation

Introduction

The DocumentServer.MailMerge class is a .NET component that can be used to merge template documents with database content effortlessly in .NET projects such as ASP.NET web applications, web services or Windows services. Internally, it uses a ServerTextControl that must be bound to the component.

Using the DocumentServer.MailMerge component, template documents containing MS Word merge fields can be easily loaded, merged with a DataSet or DataTable of the Microsoft .NET System.Drawing.Data namespace and exported to the supported file formats of TX Text Control like Adobe PDF or DOCX.

It is possible to pass a DataTable containing different columns that covers the merge field names. The data rows of the table equals the number of created documents. Optionally, it is possible to create separate documents or to append the documents to one resulting document.

Single merge fields can be inserted that will be filled with database content. Additionally, repeating blocks can be defined in the template. These blocks will be repeated according to the number of passed data rows.

The DocumentServer.MailMerge component supports the most important standard merge fields of MS Word. Supported fields are: MERGEFIELD, INCLUDETEXT, IF and DATE.