OpenXmlSdkTs - v1.0.7
    Preparing search index...

    Class WmlPart

    Word-specific part with convenience methods for navigating Word document structure.

    Extends OpenXmlPart with typed accessors for headers, footers, styles, comments, numbering, fonts, and other Word-specific parts.

    const mainPart = await doc.mainDocumentPart();
    const headers = await mainPart!.headerParts();
    const stylesPart = await mainPart!.styleDefinitionsPart();
    const commentsPart = await mainPart!.wordprocessingCommentsPart();

    Hierarchy (View Summary)

    Index

    Methods

    • Returns the MIME content type of this part (e.g., "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml").

      Returns string | null

    • Deletes a relationship from this part.

      Parameters

      • id: string

        The relationship ID to delete.

      Returns Promise<boolean>

      true if the relationship was deleted.

      Error if the relationship is not found.

    • Returns the XML content of this part as an XDocument.

      Returns Promise<XDocument>

      A promise resolving to the part's XDocument.

      The XDocument is parsed on first access and cached for subsequent calls. Modifications to the returned XDocument are reflected in the part. Call putXDocument to replace the XML content entirely.

      Error if the part is not an XML part.

      const xDoc = await mainPart.getXDocument();
      const body = xDoc.root!.element(W.body);
      const paragraphs = body!.elements(W.p);
    • Returns the endnotes part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the footnotes part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the comments part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the font table part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the numbering definitions part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the style definitions part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the web settings part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the document settings part, or undefined if not present.

      Returns Promise<WmlPart | undefined>

    • Returns the glossary document part (Quick Parts / AutoText), or undefined if not present.

      Returns Promise<WmlPart | undefined>