A single style within the style part is specified with the <w:style> element. A style definition can be divided into three components: general style properties, the style type, and the formatting properties of the style.
General style properties are the set of properties which are common to all style types--things like the style name, aliases, id, etc. See Styles - General Style Properties for more on these.
A style can be one of four different style types:
- paragraph styles
- character styles
- numbering styles
- table styles
There are also default paragraph and character styles (defined by docDefaults), and linked styles (a grouping of a paragraph style and a character style).
The above XML defines a paragraph style; it is also a linked style. The general properties are in blue. The type is in green. And the formatting properties are in orange.
<w:style> has the folowing attributes.
Specifies that the style is user-defined and is not automatically generated by the application. It can be either true (or 1) or false (or 0). If true, then the application cannot automatically change formatting associated with the style. E.g., <w:style w:type="paragraph" w:styleId="MyStyle" w:customStyle="true">.
Indicates that the style is the default for the style type of the style. This style will be used when the content does not reference a style of the type. If this attribute is specified by multiple styles, then the last instance will be used. E.g., <w:style w:type="paragraph" w:default="1" w:styleId="MyStyle">.
Specifies a unique identifier for the style. It is used throughout the document to apply styles in content, to link paragraph and character styles, and to reference parent styles for inheritance via the basedOn element. For example, the style <w:style w:type="paragraph" w:styleId="MyStyle"> will be applied to a paragraph in the document content with the following reference:
If multiple styles use the same styleId value, then the first instance keeps its id and all others are reassigned in any way the application chooses. (However, references to the reassigned styles will not be repaired.)
Specifies the type of style. Possible values are:
The child elements of <w:style> are either general styple properties or formatting style properties. For details of the general style properties, see Defining a Style - General Properties.
Formatting style properties are the properties which are not general properties common to all styles but specify the formatting of either paragraphs, characters, tables or numbered paragraphs. For details on each of these style types, see:
- Defining a Style - Character Properties
- Defining a Style - Paragraph Properties
- Defining a Style - Table Properties
- Defining a Style - Numbering Properties
Related HTML/CSS property:
- This is the first level.
- This is the second level.
- This is the third level.