Table Style Rules
When you use Tables in reports, it's useful to apply styles to the data so they stand out from the rest of the data. You can apply rules at the row level or at the column level. These rules override the general or default table settings applied in the Table tool based on conditions set for each rule.
If you use table styles to customize colors, go to Colors.
Access the Styling Rules Editor
There are 2 types of rules and there is a control button for each rule type.
Column Rules are applied to an individual field in the table. When you apply a column rule, the field the rule is applied to appears in bold in the Configuration window. You can access Column Rules in the Per Column Configuration section of the Table tool Configuration window. To apply a Column Rule...
- Select the field name to apply the rule to.
- Select the Create/Edit button to set the parameters of the rule.
Row Rules are applied to the entire row of data in a table (for example, highlighting a Total row.) You can access Row Rules from the bottom of the Configuration window. To apply a Row Rule select the Create/Edit Row Rule button to set the parameters of the rule.
To apply a Rule to the Table, the button might read one of 2 ways:
- Create Row Rule: If no rule is already applied, the button reads Create Row Rule. Select this button to create a new rule to apply to the table.
- Edit Row Rule: When a rule already exists, the button reads Edit Row Rule. Select this button to expose the rule editor so that you can edit existing rules and create new rules.
Configure the Styling Rules Editor
Rules that are currently applied either per column or per row appear in the top section of the editor. To edit an existing rule, highlight the rule to edit. Options include...
- New: Create a new rule.
- Delete: Delete the selected rule.
- Up/Down: Reorder the selected rule.
- Rule Name: Enter text to set a more descriptive name for the rule.
- Rule Conditions: Choose 1 of 3 modes to apply the Rule condition. Choices include...
- Always: Always apply the rule in all conditions. When you apply this mode to a column rule, you can choose what to apply the rule to. Choose Data Only, Header Only, or the Header and Data.
- When: Apply the rule only when the specified condition is met. Use the dropdowns to specify the condition. This condition is usually a straightforward one that does not require a complex formula.
- Formula: Apply the rule only when the specified condition is met. Select the "..." button to expose the formula editor that lets you construct a more detailed condition. This condition usually compares 2 or more variables.
When you specify a Row Rule, an additional check box displays to allow you to specify whether that rule should override an existing Column Rule. Rule Hierarchy is discussed below.
The Styles section is where you configure the styling options that are applied to the data if the condition specified above is met. Options include...
- Font: Change the font type when the condition is met. All installed fonts on the machine are displayed. Select the dropdown to select the font type. To apply Bold and Italic styles, select their respective buttons.
- Font Size: Change the font size when the condition is met. Use the up/down controls to increase/decrease the font size.
- Justification: Change the position of how the data fills the cell when the condition is met. Options include Left, Right, or Center.
- Text Color: Change the color of the text when the condition is met. Select the "..." button to expose the color picker.
- Background Color: Change the cells' background color when the condition is met. Select the "..." to expose the color picker.
- Replacement Text: When the condition is met, replace the text with the value you entered.
- Formula: Refer to the Formula Styles section below.
This is an advanced option. When the basic style overrides are insufficient, you can create your own style overrides via a formula that constructs a CSS-like style text. This formula is computed individually for each cell to which it applies, and can be very powerful. To use this option, you should have a solid understanding of CSS styles and some knowledge of PCXML and Composer.
Some Common PCXML properties to use within formulas:
- background-color: The background color of a table cell or row.
- decimal-places: The number of digits that appear after a decimal point for a numeric value.
- postfix: Text that directly follows a value.
- prefix: Text that precedes a value.
- background-image: Set an image as the background
- color: Foreground color of the object.
- border: Define the borders around an element.
- padding: The space between the element border and the element content.
- font-weight: Set how thick or thin characters in text should be displayed.
- font-style: Set the style of a font.
- text-align: Align the text in an element.
- white-space: Declare how whitespace inside the element is handled: the 'normal' way (where whitespace is collapsed), as 'pre' (which behaves like the 'PRE' element in HTML), or as 'nowrap' (where wrapping is done only through BR elements).
- text-decoration: The decoration of the text such as overline, underline, line-through, none, or blink.
To use rules effectively, you should understand which rules come 1st, and which ones override other ones. When 2 rules intend to change different styles (one changes a font, and the other changes the font size, for example), it doesn't matter which one executes 1st. But when 2 rules both intend to change the same style, only 1 of them wins. Rules are executed in this order (later rules override earlier rules):
- Default Table Settings have the lowest priority.
- Per-Column Configurations
- Row Rule with Only Basic (Non-Formula) Styles
- Column Rule with Only Basic Styles
- Row Rule with Only Basic Styles with the Override Check Box Selected
- Row Rule With Formula Styles
- Column Rule with Formula Styles
- Row Rule with Formula Styles with the Override Check Box Selected
Here is another way to look at this:
- Formula styles always take precedence over non-formula (basic) styles.
- Column rules usually take precedence over row rules, unless the row rule explicitly has its "override column rules" check box checked.
- Rules take precedence over the per-column and default table settings.
- Multiple rules of a given type (row or column, basic, or formula) execute in the order they are listed in the rule editor.