We already have code that sets background color using a special merge field handler like this:
DocumentBuilder.MoveToMergeField(mergeFieldName);
Color color = Color.FromName(mergeFieldValue);
if (DocumentBuilder.CurrentParagraph.IsInCell)
DocumentBuilder.CellFormat.Shading.ForegroundPatternColor = color;
else
DocumentBuilder.CurrentParagraph.ParagraphFormat.Shading.ForegroundPatternColor = color; // Untested
Notice that the merge field’s value contains the named color (It’s a status: Red, Yellow, Green)
Now I have a request for the same functionality but for font/foreground color.
The content of the table cell is something like this:
<<MergeFieldThatChangesForegroundColor>><<AnotherMergeField>>
some text
I would like to alter the color of the entire cell or paragraf to the desired color.
I have tried:
DocumentBuilder.Font.Color = color;
But nothings happens as I don’t have anything to write to the document when I’m in the handler for “MergeFieldThatChangesForegroundColor”.
Suggestions?