The reporting engine TXTextControl.DocumentServer.MailMerge supports various types of data sources that can be used to merge MS Word compatible documents with data. Supported data sources include DataSets, DataTables, Json objects, hierarchical IEnumerable objects and single business objects.

The TXTextControl.DocumentServer.DataSources.DataSourceManager encapsulates the complete handling, logic and ready-to-use dialog boxes for reporting template creation tasks. Essentially, the DataSourceManager provides all information required to create a fully-featured template designer. Like with MailMerge, a data source can be loaded from a DataSet, DataTable, Json, an object or XML. The following diagram shows the classes in detail:

TX Text Control DataSourceManager

But the DataSourceManager cannot only be used to manage data sources for template creation tasks - it can be also used to merge the actual document. The advantage: You can use more direct data sources to pass data to MailMerge including assemblies, XML files and strings and data source configuration files. The main reason for the merge capabilities of the DataSourceManager is to preview templates in a template designer. Therefore, it is not possible to trap MailMerge events such as the TXTextControl.DocumentServer.MailMerge.BlockRowMerged event.

The following code is using an instance of TXTextControl.ServerTextControl and the DataSourceManager to merge XML data into a template:


The template must be loaded using the internal TX Text Control file format and resulting documents are returned as byte arrays in the internal TX Text Control format.

The DataSourceManager can load data from the following sources:

  • Assembly
  • DataTable
  • DataSet
  • DataSourceConfig files
  • Json
  • Objects
  • Single object
  • XML file
  • XML string

Conclusion: The merge capability of the DataSourceManager is a very powerful tool to manage loaded data sources and to merge data into templates when creating a template designer.