/** * Document Split API * * Split a single DocxDocument into multiple documents based on * sections, page breaks, or heading levels. */ import type { DocxDocument } from "../types.js"; /** Options for splitting a document. */ export interface SplitOptions { /** * Split criteria. * * - `"section"` — split at every section break (paragraph with `sectionProperties`). * - `"pageBreak"` — split at every explicit page break (run with `breakType: "page"`). * - `"heading"` — split at every Heading 1 paragraph (or `headingLevel`). * * Default: `"section"`. */ readonly by?: "section" | "pageBreak" | "heading"; /** * Heading level to split on (only used when `by: "heading"`). * Default: 1 (Heading 1). */ readonly headingLevel?: number; /** * Whether each split document keeps the original document's * styles, numbering, settings, fonts, etc. * Default: true. */ readonly preserveSharedParts?: boolean; } /** * Split a DocxDocument into multiple documents. * * Each resulting document is a complete, valid DocxDocument with body content * from one segment of the original. Headers, footers, footnotes, endnotes, * comments, styles, numbering, and settings are preserved in each split unless * `preserveSharedParts: false` is specified. * * @param doc - The document to split. * @param options - Split criteria. * @returns Array of split documents (at least 1). */ export declare function splitDocument(doc: DocxDocument, options?: SplitOptions): DocxDocument[];