/** * Document Merge API * * Merge multiple DocxDocument bodies into a single document. * * The first document is taken as the base (its styles, settings, page layout, * etc. become the foundation). Each subsequent document is appended after a * section break. Numbering definitions, instances and the body references * that point to them are rewritten when the appended document collides with * IDs already present in the base. Image rIds, footnote/endnote ids and * comment ids are also remapped, and the corresponding parts (footnotes, * endnotes, comments) are merged so that references emitted in the body * still resolve. * * What is *not* merged today (callers needing these should compose at a * higher level): * - headers / footers (only the base document's are kept; appended * documents' header/footer parts are dropped) * - customXmlParts, embeddedFonts, settings, coreProperties, app * metadata, theme, document protection, signatures, vbaProject * * Body content from appended documents is deep-cloned so that callers' * models are never mutated. */ import type { DocxDocument } from "../types.js"; /** Options for merging documents. */ export interface MergeOptions { /** Break type between merged documents. Default: "nextPage". */ readonly sectionBreak?: "continuous" | "nextPage" | "evenPage" | "oddPage"; } /** * Merge multiple DocxDocument bodies into a single document. * * The first document is used as the base (preserving its styles, numbering, * settings, etc.). Subsequent documents' body content is appended with * section breaks between them. IDs that collide with the base are remapped * during the deep-clone of each appended body: * - paragraph numbering refs (numId) * - inline / floating image rIds * - footnote, endnote and comment references (and their range markers) * * The corresponding `footnotes`, `endnotes`, `comments` and `images` * collections are merged in tandem so references emitted into the body * still resolve in the output package. * * @param documents - Array of documents to merge (at least 1). * @param options - Optional merge settings. * @returns A new merged DocxDocument. */ export declare function mergeDocuments(documents: readonly DocxDocument[], options?: MergeOptions): DocxDocument;