Class DocumentMergeExtensions
Section-level merge and split.
Ownership. Everything the imported content needs is materialized during the call: image bytes are read into the destination, not referenced back into the source's package. The source document may be disposed immediately afterwards. If it has already been disposed, its media cannot be read and the merge fails with InvalidDocumentException rather than producing a document with empty pictures.
What is not carried across. A merge moves content, not the package. The destination keeps its own theme, settings and document defaults, and the source's opaque package parts — custom XML, document properties, embedded objects, the glossary — stay behind. Those describe a document, not the sections being imported, and there is no meaningful way to have two of them. COMPAT.md enumerates the loss.
public static class DocumentMergeExtensions
- Inheritance
-
DocumentMergeExtensions
- Inherited Members
Methods
- Merge(WordDocument, WordDocument, MergeOptions?)
Appends every section of
sourcetodestination, remapping the style, numbering, note, bookmark and relationship ids that collide.
- Split(WordDocument, int, int)
Extracts a run of sections into a new standalone document carrying only the definitions that run actually references.