Working with conditional paragraph styles

From Apache OpenOffice Wiki
Jump to: navigation, search

A conditional paragraph style is another way of formatting text differently in different parts of your document. In some cases, you may find it saves time to use conditional styles rather than switching between styles as you type.

Making a paragraph style conditional means it changes its formatting depending on where it is used. For example, you may want the style MyTextBody to be black by default but turn white when inside a frame with a blue background.

Probably the most common use for conditional formatting is with single-style outlining. Single-style outlining is a type of outline numbering designed with a Numbering style, rather than with Tools > Outline Numbering. Instead of using different styles, it changes the number formatting whenever you press the Tab key to create a subordinate heading.

The only trouble with single-style outlining is that all levels look the same. That is where a conditional paragraph style comes in handy. Assign the paragraph style to an outline numbering style in the Numbering page and then open the Condition page. There, you can assign the levels of the outline numbering style to other paragraph styles. Then, when you press the Tab key while using the paragraph style, each level of the outline takes on different formatting, making single-style outlining even more convenient than it is on its own.

Condition page for paragraph styles.
Documentation note.png Predefined styles (other than Text body) such as Default, Heading 1, and Heading 2 cannot be set to be conditional.
Documentation caution.png If you want to make a style conditional, you have to do it while the style window is still open for the first time. After the window closes, the Condition tab no longer appears in the window.

When you create a conditional style, you are saying “in this condition make this style look like that other style”. For example, “When typing into a footer, make this style look like the my_footer paragraph style; when typing into a table, make this style look like the table_text paragraph style”.

In addition to setting the normal (unconditional) properties of the style, you need to define which other style it will look like in different situations. You do this on the Condition tab.

To set up a conditional paragraph style:

  1. Define a new paragraph style.
  2. Select all the paragraph properties for the style. Do not click OK!
  3. Click the Condition tab.
  4. Select the Conditional Style option.
  5. Select the first condition in the Context list (left side of the dialog box) and select the style you want for this condition in the right-hand list.
  6. Click Apply. The name of the paragraph style appears in the middle list.
  7. Repeat steps 5 and 6 for each condition you want to have linked to a different style.
  8. Click OK.

When the style is selected, you will see that the formatting of your text depends on the context.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools