Paper Office
paper-docxAPI referencecomposition

docx.composition

paper-docx 0.2.0 API reference

Cross-document composition.

Copying formatted content between documents is style/numbering/relationship reconciliation — exactly the package-level, corruption-prone mechanics this fork exists to own. insert_blocks_from copies a block range from a source document; append_document appends a whole source body. Both return a CompositionReport declaring every part the operation may touch plus the style/numbering/bookmark maps and report-only findings.

Semantics: styles reconcile by match_by_name (destination definition wins) or import_renamed (colliding-but-different definitions clone under fresh ids/names); numbering always REMAPS to fresh restarted definitions; images copy as new parts with fresh rIds; external hyperlinks are recreated; bookmarks rename on collision with REF instructions inside the range remapped. Source revisions or comments inside the range refuse (accept or reject the source revisions first; comments in the range also refuse); embedded OLE objects and note references refuse (declared).

On this page