GenOffice docx patch (byte-preserving)
genoffice_docx_patchRewrite specific .docx paragraphs preserving all unedited content exactly. Only changed blocks are regenerated, so layout and styles stay intact. Outputs a new patched file.
Instructions
Rewrite one or more paragraphs of a .docx using the GenOffice byte-preserving roundtrip: only the edited blocks are regenerated as OOXML fragments; every untouched block keeps its original bytes, so layout, styles, headers, comments and other parts survive. Paragraph formatting (styleId/rawPPr) is carried over. Input: file path + edits [{index, text}] where index comes from genoffice_docx_blocks (0-based visible order). Output: a new patched file (never modifies the original).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the source .docx (never modified) | |
| edits | Yes | Paragraph rewrites to apply | |
| outPath | No | Absolute output path; defaults to <dir>/<name>.patched.docx |