OpenXmlSdkTs - v1.0.7
    Preparing search index...

    Class SmlPart

    Excel-specific part with convenience methods for navigating workbook structure.

    Extends OpenXmlPart with typed accessors for worksheets, shared strings, styles, charts, pivot tables, and other Excel-specific parts.

    const workbook = await doc.workbookPart();
    const worksheets = await workbook!.worksheetParts();
    for (const ws of worksheets) {
    const xDoc = await ws.getXDocument();
    const rows = xDoc.root!.element(S.sheetData)?.elements(S.row) ?? [];
    console.log(`${ws.getUri()}: ${rows.length} rows`);
    }

    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 calculation chain part, or undefined if not present.

      Returns Promise<SmlPart | undefined>

    • Returns the cell metadata part, or undefined if not present.

      Returns Promise<SmlPart | undefined>

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

      Returns Promise<SmlPart | undefined>

    • Returns the workbook revision header part, or undefined if not present.

      Returns Promise<SmlPart | undefined>

    • Returns the workbook styles part, or undefined if not present.

      Returns Promise<SmlPart | undefined>

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

      Returns Promise<SmlPart | undefined>