Conditional Formatting for Document Templates

Conditional formatting allows you to change the format of the output of a tag based on your own conditions. 

For example, you can:

  • Change the text color to red if a value is negative
  • Set the cell background color based on whether a request is open(red), pending(yellow), or closed(green)
  • Use one parameter to change multiple format settings in an entire document

Conditional Formatting Editor

The conditional formatting editor is used to set formatting options for <out> tags when defined conditions are met.

The Conditional Formatting Editor is inside of the Tag Editor, in the Tag section, click the three dots (...) to the right of condition.

The Conditional Formatting Rule Manager lists all of the current rules you have set for the tag.

Add a New Rule Adds a New Rule

The Condition is what you want to test against. If this is true, then the special formatting will be applied. At this time, the condition must be entered manually.The Format is the special formatting applied if the Condition is true.

Stop If True determines whether the rules below are used if this rule is true.Delete will delete the rule.

Format Options Windows

In general, the format options are self explanatory.

When setting a color, you must use the hexidecimal value. For example, for red you need to enter FF0000. We will be adding a color picker to do this visually.

Conditional Formatting Tutorial

  1. Start with a basic template containing a table.
  2. When you run this report by clicking the Output button and then selecting DOCX, the output does not contain any conditional formatting.
  3. The objective for the purpose of this tutorial is to have the “Units On Order” column be bold and have a red text color if the value is greater than zero.  
    Open the Tag Editor for the UnitsOnOrder tag by double-clicking it.
  4. Click the button next to the Condition setting.
  5. This displays the Conditional Formatting Rule Manager, where you can set up the rules for formatting.
  6. Enter the condition where you want to change the formatting.
  7. Click the wand next to the Format box to set the format settings.
  8. Click OK.  
    The Format box now contains a format code.
  9. Click OK to set the rule and then click Save Tag to save the changes to the tag.
  10. When the report runs, the units in order with a greater value than zero in bold and red text is provided.
Notes for Working with Conditional Formatting
  • The condition for a rule is a formula that must have a result of true or false.  Note that conditions begin with an = character.
  • If you have multiple rules, rules higher up the list are applied first. Rules lower on the list are applied later. If you set the “Stop If True” option for a rule, then when the rule evaluated to true no further rules are applied for that tag.
  • Cell format settings are only applied to tags in a cell, like within a table cell in Microsoft Word.