I am using the mail merge functionality of Aspose words to populate data in a word template. One of the things I am trying to do during this merge is to change text colors and colors of surrounding table cells based on the data source. Specifically, I have merge fields inside of a table and when they get passed a value “PASS” I want to change the background color of the table row they are in to green. And conversely, if it is “FAIL” I want to color the row red.
Currently, I have a class that implements IFieldMergingCallback so I can do this on a field by field basis. However, I am unable to get the Row object of the row that the field resides in.
var row = (Row)args.Field.Start.GetAncestor(NodeType.Row);
just returns null.
Does anyone know how or if this can be done?