The TXTextControl.DocumentServer.MailMerge.FieldMerged returns useful information and options to manipulate the merged content in the TXTextControl.DocumentServer.MailMerge.FieldMergedEventArgs .

Since version X14 (24.0), the TXTextControl.DocumentServer.MailMerge.FieldMergedEventArgs.TableCell property returns a TXTextControl.TableCell object in case the merge field is positioned inside a table. This can be used to manipulate the table cell based on merged values.

Consider the following data structure and instance that is used to merge a template:

Loading...

The following code creates a new instance of the reporting engine TXTextControl.DocumentServer.MailMerge , attaches the FieldMerged event and calls the TXTextControl.DocumentServer.MailMerge.MergeObjects method to merge a template with the created data object.

Loading...

In the FieldMerged event, the field value is parsed and mapped to a color based on the value range. Accordingly, the background color of the outer table cell is highlighted.

Loading...

The following screenshot shows the results of this merge process:

Colored table cells

This is just one of many ideas what to do with the flexible reporting framework MailMerge to customize the merging process.