This combination allows creative implementations such as conditional table cell colors based on specific filter instructions.
In the following sample, the table cell Qty should be highlighted red, if quantity is higher than 10, otherwise it should be green.
These conditions can be adjusted in the following dialog:
When merging the document, the conditions are evaluated in the custom events:
The class CellFilterInstructions contains the instructions for the custom filter:
This class is serialized as JSON and stored in the property. When a new dialog is opened, the JSON is deserialized and passed to the dialog. After changes are made, the object is stored as a serialized JSON string back in the TableCell.Name property.
In the FieldMerging event, the instructions are evaluated and the custom background color is applied to the cell that is returned in the event arguments:
Test this sample on your own and download the GitHub repository:
Download and Fork This Sample on GitHub
We proudly host our sample code on github.com/TextControl.
Please fork and contribute.
Requirements for This Sample
- Visual Studio 2017 or better
- TX Text Control .NET for Windows Forms (trial sufficient)