Formatting rules feature is one of the most important features of the template designer. It allows to create rules with specific criteria, and apply particular formatting to the corresponding elements when this criteria is met.

Formatting rules may be applied to any report element (like labels) or whole bands.

Formatting rules allow may affect the following properties when applied to elements:

    • Background color
    • Border color
    • Border dash style
    • Borders
    • Border width
    • Font
    • Foreground (text) color
    • Padding
    • Text alignment
    • Visibility

This feature is extensively used in invoice templates. For example, you may select invoice accent color in the program settings. Depending on the selected color, invoice elements will have different background and foreground colors. This has been achieved using formatting rules feature. Another example is possibility to hide template elements depending on values of the invoice being printed. Visibility change option allows to hide tax amounts if no any tax is selected in the invoice being printed. The same applies to invoice notes, discounts and any other elements.

Formatting rules are created via Formatting rule sheet property of the template. You may access it via report helper menu:

or via report properties window:

Here is an example of Formatting rule sheet window:

In the example above you see, that ruleTax1 is selected. In the Condition property a criteria is created using built-in visual criteria builder, which meas that this condition is met when Tax1 field of the printed invoice is not empty. When this criteria is met, Visible property of the attached element is changed to Yes. If you will find SubBandTax1 band in the report and select it, you will see that its Visible property is set to No. This means that this band is not printed by default. In the Formatting rules property of this band this rule (ruleTax1) is applied. This allows to change Visible property of the SubBandTax1 band from No to Yes, when Tax1 field of an invoice being printed is not empty.

It is not required from you to remember how to use IsNull function - it can be picked-up from the list in the condition editor:

Thus, you may easily build complex criteria.

Created with the Personal Edition of HelpNDoc: Write eBooks for the Kindle