Mail ╰ TX Text Control .NET for Windows Forms
╰ 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. is a powerful, extensible framework that allows you to inject custom logic to the merge process. The TXText ╰ TX Text Control .NET for Windows Forms
╰ DocumentServer Namespace
╰ MailMerge Class
╰ FieldMerged Event
Occurs when a field has been merged. can be used to manipulate the results, but also gives access to the surrounding instance of the TXText ╰ TX Text Control .NET for Windows Forms
╰ TXTextControl Namespace
╰ TableCell Class
An instance of the TableCell class represents a single cell of a table in a Text Control document. .
This enables you to implement features such as conditional table cell colors based on specific filter instructions.
In this sample, the table cell Qty should be highlighted red, if quantity is higher than 10, otherwise it should be green.
This sample shows two interesting aspects:
-
It shows how to use the JavaScript API to store data in the Table
Cell ╰ TX Text Control .NET Server for ASP.NET
╰ JavaScript API
╰ TableCell Object
Represents a single cell of a table in a Text Control document. object. - And it illustrates how to merge the created document server-side using Mail
Merge ╰ 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. .
The sample implements HTML form elements to set the conditions for table cells. If the input position is inside a table cell, the following code is used to store the conditions in the table cell by serializing the object as a Json string:

If the input position is changed to another cell, the form elements are updated to reflect the conditions of that cell:

Finally, when clicking Merge, the document is saved and sent to the backend controller:

In the controller, an HttpPost method accepts the document and calls the Merge ╰ TX Text Control .NET Server for ASP.NET
╰ DocumentServer Namespace
╰ MailMerge Class
╰ MergeJsonData Method
Merges data given as a JSON string into a document template. method to merge data into the given template:

The Field ╰ TX Text Control .NET Server for ASP.NET
╰ DocumentServer Namespace
╰ MailMerge Class
╰ FieldMerged Event
Occurs when a field has been merged. event is attached to handle the custom condition. If the field is inside a table cell, the Table ╰ TX Text Control .NET Server for ASP.NET
╰ TXTextControl Namespace
╰ TableCell Class
╰ Name Property
Gets or sets the cell's name. property is deserialized to a CellFilterInstructions object in order to apply the table cell color according to the defined instructions.

Test this on your own by downloading the sample project from our GitHub repository.