Creating custom (new) styles

From Apache OpenOffice Wiki
Jump to: navigation, search


In addition to using the predefined styles provided by OOo, you can add new custom (user-defined) styles. In Chapter 6, two methods were given for creating a new style: the drag-and-drop approach and the New Style from Selection icon in the Styles and Formatting window.

These methods are very convenient because it is possible to immediately check the visual effects that the style produces before creating it. However, they may require you to access several different menus, and you have a somewhat reduced amount of control on style (particularly when it comes to organizing them). The method described in this chapter, therefore, concerns only the use of the Style dialog box.

The Style dialog box

Open the Styles and Formatting window. Select first the category of style you want to create by clicking on the appropriate icon in the top part of the Styles and Formatting window. For example, select the third icon from the left if you want to create a new frame style.

Right-click on the main window and select New from the pop-up menu. If you right-click on an existing style, the new style will be linked to the style you clicked on. If you right-click on an empty area, then the initial settings of the style are copied from the Default style of the corresponding category.

The dialog box that is displayed depends on the type of style you selected. Many of the pages are the same as those that are displayed when manual formatting is applied. Therefore, if you are familiar with manual formatting, you will find that you already know how to use most of the options. The dialog box used to create a new style and to modify an existing one is exactly the same.

Tip.png An exception to the above rule is conditional styles, which have a different dialog box. See Working with conditional paragraph styles.


The Organizer page

When creating a new style, the first page you need to set up is the Organizer, which is shown below. This page is common to all style categories. Therefore, it is described only once.

The Organizer page displayed when a new style is created.

Depending on the style you are creating, you will find the following information on this page:

  • Name: present on all the categories—use this field to give a name to the style you are creating.
  • AutoUpdate: this option is only present for paragraph and frame styles. If it is checked, then OOo will apply any modification made manually to a paragraph formatted with that style to the style itself.
Documentation caution.png If you are in the habit of manually overriding styles in your document, be sure that AutoUpdate is not enabled, or you will suddenly find whole sections of your document reformatting unexpectedly.
  • Next Style: this field is only available for paragraph and page styles. Use it to specify which style will be applied to the next element. It is customary, for example, to have a left page style followed by a right page, a first page followed by a left page, a heading followed by body text, and so on. You will see in the example later about how this property is used. Predefined paragraph styles for lists or bullets also make large use of the Next Style property.
  • Linked with: this field is available for paragraph, character, and frame styles; it determines the position of the style in the hierarchy. When creating a new style and linking it to an existing style, all the starting properties of the style are copied from the linked style. Refer to Understanding linked styles for further information on how linked styles work.
  • Category: this field is available for all style categories of styles, and it allows you to associate the new style to one of the categories. Note that you cannot change the category of the predefined styles. Setting this field is useful when filtering the contents of the Styles and Formatting window.
  • Contains section: the lower part of the Organizer page shows a summary of the properties of the style.

Understanding linked styles

When creating a new paragraph or a new character style, you may use an existing style as a starting point for its settings. In this sense, OOo links the styles together. When styles are linked, a change in the parent style affects every style linked to it. You can easily visualize the connections between styles by switching to the Hierarchical view in the Styles and Formatting window filter.

For example, every Heading style (such as Heading 1, Heading 2) is linked with a style called Heading. This relationship is illustrated below.

Hierarchical view of linked styles.

Linking styles is a very powerful method to create “families” of styles and allows you to change their properties simultaneously. For example, if you decide that all the headings should be blue (such as in this guide), you only need to change the font color of the parent style to achieve the desired result. Note however, that changes made to a parameter of the parent style do not override changes previously made to the same parameter in the children styles. For example, if you changed the Heading 2 font color to green, a change of the font color of the Heading style (the parent style) to red will not affect the Heading 2 font color.

You can easily check which properties are specific to a style by looking at the Contains section of the Organizer page. In case you want to reset the properties of a child style to that of the parent style, click the Standard button located at the bottom of each Paragraph and Character style dialog page.

Documentation note.png You cannot define a hierarchical style structure for Page, Frame and List styles.

Creating a linked style

To create a linked style, you can either specify the parent style in the Organizer page of the Style dialog box, or you can start creating a new style by right-clicking on the style that you want to link to the new style and selecting New from the drop-down menu.

Example: Changing a property of a parent style

Suppose that you want to change the font of not only Heading 1 or Heading 2, but all headings. The easiest way to do that is to take advantage of this linking. Open the Styles and Formatting window (press F11) and select Heading.

Select Heading style.

Open the Paragraph Style dialog box for the Heading style (right-click > Modify) and select the Font tab. Select a font and click OK.

Select the heading font.

Now, the fonts of all the heading styles (Heading 1 through Heading 10) have been changed in a single operation. Figure 5 shows to the left a document using the headings 1, 2 and 3 and on the right the same document after changes have been made to the Heading style.

Effects of changing the Heading style font.


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