Frequently asked questions - Writer

From The Document Foundation Wiki
< Faq‎ | Writer
Jump to: navigation, search

How to adapt the presentation of the text depending on the outline?

You want the text to shift automatically following the outline level. Example of the expected output:

copie d'écran texte aligné sur niveaux de titre avec retraits différents
Adaptation of indents according to the outline level

It is possible to obtain this effect automatically using Conditional Styles.

This functionality allows a single style to take on the attributes of other styles depending on the context.

For example, used in the header of a page, the Text Body style could take the attributes of the Header Style. It goes without saying that such "extreme" usage could not be recommended because of the confusion which would arise. However the feature is quite suitable for the automatic indentation we would like to use here.

In this example, the text will use only one conditional style (the titles use Heading1, Heading2, and Heading3 respectively ).

The text style applied is automatically adapted to the context: when the text is in "level 2", a predefined layout in another style is applied. The same applies for level 3, etc.

This is very handy because you don't have to bother about the layout when entering text : you choose the "conditional" style and, when you apply the titles, the layout adapts by itself.

To follow this example, you need to create 2 styles: Text Level 2 and Text Level 3 (you can chose the name that you want) which are "ordinary" paragraph styles with only an indent defined before the text. These 2 styles are not directly applied in the document.

Then you create the conditional paragraph style (eg. Text Levels) used in the text following these steps:

  • In the Styles & Formatting panel, right click on the Text Body paragraph style, then chose New
  • Under the Organizer tab of the Paragraph Style dialog, give a name for the style (eg. Text Levels)
  • Under the Condition tab, check Conditional Style
  • In the Context list, select 2nd Outline Level, in the Paragraph Styles chose Text Level 2, click on Apply

copie d'écran dialogue création style, onglet Condition
Creation of a conditional style

Repeat the previous step for the third level with the style Text Level 3


  • The Condition tab in only available during style creation
  • When changing the level of a heading in the text (for example, you move the paragraph from Heading1 to Heading2, the context is not updated automatically and the conditional style is not automatically adapted.

Two solutions:

  1. reapply the style by double clicking on the Style window.
  2. or, if there are several paragraphs involved, use the Edit ▸ Search & Replace menu, click on More Options and check Search for styles, in the Search for and Replace with lists, select the conditional style name and click on Replace all.