Last active
October 8, 2020 12:01
-
-
Save bjoerntx/16222de73bca7988b29b807dcb2c311f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void MailMerge_FieldMerged(object sender, | |
TXTextControl.DocumentServer.MailMerge.FieldMergedEventArgs e) | |
{ | |
// custom field handling | |
if (e.TableCell == null) | |
return; | |
// if TableCell.Name has instructions, create a CellFilterInstructions object | |
// and evaluate the instructions and set the table cell color | |
if (e.TableCell.Name != "") | |
{ | |
CellFilterInstructions instructions = | |
(CellFilterInstructions)JsonConvert.DeserializeObject( | |
e.TableCell.Name, typeof(CellFilterInstructions)); | |
// retrieve the color | |
Color? color = instructions.GetColor(e.MailMergeFieldAdapter.ApplicationField.Text); | |
// apply the color | |
if (color != null) | |
e.TableCell.CellFormat.BackColor = (Color)color; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment