docx
    Preparing search index...

    Class DocumentBackground

    Represents a document background in a WordprocessingML document.

    The background element specifies the background color or theme color for the document.

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

    <xsd:complexType name="CT_Background">
    <xsd:sequence>
    <xsd:sequence maxOccurs="unbounded">
    <xsd:any processContents="lax" namespace="urn:schemas-microsoft-com:vml" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:any processContents="lax" namespace="urn:schemas-microsoft-com:office:office" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:element name="drawing" type="CT_Drawing" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="color" type="ST_HexColor" use="optional" default="auto"/>
    <xsd:attribute name="themeColor" type="ST_ThemeColor" use="optional"/>
    <xsd:attribute name="themeTint" type="ST_UcharHexNumber" use="optional"/>
    <xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
    </xsd:complexType>
    new DocumentBackground({ color: "FFFF00" }); // Yellow background
    new DocumentBackground({ themeColor: "accent1" }); // Theme accent color

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Prepares this component and its children for XML serialization.

      This method is called by the Formatter to convert the component tree into an object structure compatible with the xml library (https://www.npmjs.com/package/xml). It recursively processes all children and handles special cases like attribute-only elements and empty elements.

      The method can be overridden by subclasses to customize XML representation or execute side effects during serialization (e.g., creating relationships).

      Parameters

      • context: IContext

        The serialization context containing document state

      Returns IXmlableObject | undefined

      The XML-serializable object, or undefined to exclude from output

      // Override to add custom serialization logic
      prepForXml(context: IContext): IXmlableObject | undefined {
      // Custom logic here
      return super.prepForXml(context);
      }