w:styles (Style Definitions)
Root element of the Styles part (styles.xml), containing all paragraph, character, table, and numbering style definitions.
Child elements
Description
w:styles is the root element of the styles.xml part, containing all paragraph, character, table, and numbering style definitions for the document. It is defined in ECMA-376 Part 1 §17.7.4.18.
It contains an optional w:docDefaults element (default run and paragraph properties), followed by zero or more w:style elements. Styles are referenced from paragraphs (w:pStyle), runs (w:rStyle), and tables (w:tblStyle).
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | Content is expressed entirely via child elements. |
Examples
<w:styles xmlns:w="...">
<w:docDefaults/>
<w:style w:type="paragraph" w:styleId="Normal">
<w:name w:val="Normal"/>
</w:style>
</w:styles>
var stylesPart = doc.MainDocumentPart.StyleDefinitionsPart;
// or add new:
stylesPart = doc.MainDocumentPart.AddNewPart<StyleDefinitionsPart>();
stylesPart.Styles = new Styles();