The reporting engine TXTextControl.DocumentServer.MailMerge class 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.
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 class TX Text Control .NET Server for ASP.NET
DocumentServer.DataSources Namespace
DataSourceManager Class
The DataSourceManager class is designed for handling all existing kinds of data sources which can be used together with the MailMerge class.
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 TX Text Control .NET Server for ASP.NET
DocumentServer Namespace
MailMerge Class
BlockRowMerged Event
Occurs when a merge block row has been merged successfully.
.

The following code is using an instance of TXTextControl.ServerTextControl class TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
and the TXTextControl.DocumentServer.DataSources.DataSourceManager class TX Text Control .NET Server for ASP.NET
DocumentServer.DataSources Namespace
DataSourceManager Class
The DataSourceManager class is designed for handling all existing kinds of data sources which can be used together with the MailMerge class.
to merge XML data into a template:

IList<byte[]> documents;
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
byte[] bTemplate = File.ReadAllBytes("template.tx");
TXTextControl.DocumentServer.DataSources.DataSourceManager dsManager =
new TXTextControl.DocumentServer.DataSources.DataSourceManager();
dsManager.LoadXmlFile("sample_db.xml");
documents = dsManager.Merge(bTemplate, textControl1);
}

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.