docx
    Preparing search index...

    Class Styles

    Represents the styles definitions in a WordprocessingML document.

    The styles element contains document defaults, latent styles, and individual style definitions for paragraphs and characters. Styles provide a way to define consistent formatting across a document.

    Reference: http://officeopenxml.com/WPstyles.php

    <xsd:complexType name="CT_Styles">
    <xsd:sequence>
    <xsd:element name="docDefaults" type="CT_DocDefaults" minOccurs="0"/>
    <xsd:element name="latentStyles" type="CT_LatentStyles" minOccurs="0" maxOccurs="1"/>
    <xsd:element name="style" type="CT_Style" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    // Create styles with custom paragraph and character styles
    new Styles({
    paragraphStyles: [{
    id: "CustomHeading",
    name: "Custom Heading",
    basedOn: "Normal",
    run: { bold: true, size: 28 }
    }],
    characterStyles: [{
    id: "Highlight",
    name: "Highlight",
    run: { color: "FF0000" }
    }]
    });

    Hierarchy (View Summary)

    Index
    • get writtenAs(): readonly BaseXmlComponent[] | undefined
      Internal

      The components written in this one's place, one after another, when it can't be written as a single element, such as a run with another run in its children. Undefined when it is written as itself.

      Returns readonly BaseXmlComponent[] | undefined

    • Writes the styles in the schema's order: the document defaults, the latent styles, then the styles. A style id can only be used once, so a style replaces an earlier one with its id. That way external styles replace docx's default styles, and paragraph and character styles replace the default and imported ones. Of several document defaults, or several latent styles, the last is kept. Normal is marked as the default paragraph style when no style is.

      Parameters

      Returns IXmlableObject