Skip to main content

Conditional Formatting For Out Tags



This article shares a simple example on how to use conditional formatting for Out Tags in your Microsoft Office Word, Excel, and PowerPoint templates. For version 10 and later.



Conditional formatting allows you to change the format of the output based on a certain conditions you set in your template.  An example of conditional formatting could include:

  • 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

Of course, you are not limited to these examples.



Conditional Formatting Tutorial Video: This video demonstrates how to use AutoTag's conditional formatting features to turn your report into something truly unique and visually stunning.



Conditional Formatting Editor

The conditional formatting editor is used to set formatting options for Out Tags when defined conditions are met. Learn more.


Conditional Formatting Example

In the following example, we take a very simple template using ForEach Tags and Out Tags and add conditional formatting. You can download the DOCX template we'll be using here.


  1. We start with a basic template containing a simple data table:



  1. Click the Output button to view the report and choose the DOCX format.  Note that the Output does not display any formatting in the text. 



  1. We want to have the ‘UnitsOnOrder’ column to be bold and have a red text color if the value is greater than zero.  To do this, open the Tag Editor by double clicking the [UnitsOnOrder] Out Tag.



  1. Click the ‘…’ button next to the ‘condition’ property to bring up the Conditional Formatting Rule Manager.



  1. In the ‘Condition’ field, type the condition we want to use for our formatting rule. This condition will test to see if the [UnitsOnOrder] is a number greater than zero. Note: Remember when referencing data in a ForEach Tag, you must use the syntax =${varX.NodeName}.



  1. Click the wand button next to the Format field to open the Format Options window. Select the Bold option and make the Text color ‘ff0000’ (the hex value for red).



  1. Click Ok. You can now see the Format field contains format code. Click OK to set the rule.



  1. In the Tag Editor window, click the Save Tag button to save our formatting changes to the Out Tag.


  1. Click the Output button and select the DOCX format.  On Output, the units on order with a greater value than zero will be formatted bold with red text. 



You have now used conditional formatting to enhance your document or report.


Notes for working with conditional formatting

  • In the case of a SQL query, you must use the form ‘items[1].ColumnName’ to access a specific column in a row.

  • 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 evaluates to true, no further rules are applied for that tag.
  • In a table in Microsoft Word, cell format settings are only applied to tags within the cell.
  • Was this article helpful?