DOCX Tool
Use docx-tool instead of writing a one-off Word-processing script.
Prepare
- Run
command -v docx-tool. - If missing and this repository is available, run
uv tool install .. Otherwise runuv tool install git+https://github.com/evrenverse/docx-tool. - Run
docx-tool --version. - Run
docx-tool capabilities --jsonanddocx-tool doctor --json. - Use
docx-tool schema <name>when constructing structured input. - Work on a copy unless the user explicitly wants an in-place edit.
Inspect before editing
- Run
docx-tool info <file> --json. - Use
find,read --paragraphs, orread --table --cells. - Remember that all DOCX addresses are one-based.
- Avoid an unscoped full read when bounded content is enough.
Edit and verify
- Prefer one
writeorbatchoperation for related edits. - Treat any failed operation as a failed transaction; the CLI writes nothing.
- Read every changed paragraph or table cell back with
--json. - Report the output path and any round-trip limitation.
Use comment only for an entire ordinary body paragraph. Inspect revisions
before accept-changes; that command aborts if unsupported change markup
remains. Do not use this CLI to rewrite a digitally signed DOCX.
Read references/cli.md when exact syntax, operation schemas, or LibreOffice requirements are needed.