docx

Create, edit, and validate Word .docx documents via OOXML manipulation.

2|Updated Mar 29, 2015
One-click install
npx skills add https://github.com/ovisan/dotfiles --skill docx-ovisan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/ovisan/dotfiles/tree/main/.grok/skills/docx
Command: npx skills add https://github.com/ovisan/dotfiles --skill docx-ovisan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires docx, defusedxml, lxml, pandoc, libreoffice, poppler, and includes scripts (resource) components.

What problem does it solve? Working with Word documents programmatically is error-prone: docx-js cannot open existing files, Word fragments text across XML runs, tracked changes require precise markup, and comments span six cross-linked files. This Skill provides tested workflows and scripts that handle these pitfalls reliably. ## Core Features & Use Cases - Document Creation: Generate new .docx files with the docx npm library, with guidance on page sizes, tables, lists, images, and tables of contents. - Editing & Redlining: Unzip, edit word/document.xml directly, merge fragmented runs for find-and-replace, add tracked changes, and validate against XSD schemas. - Comments & Review: Add threaded comments with the comment.py helper and accept all tracked changes via LibreOffice automation. - Use Case: A user needs to redline a contract: unpack the .docx, merge runs, edit the XML with w:ins/w:del wrappers, validate with the author flag to confirm every change is tracked, then rezip into a clean deliverable. ## Quick Start Use the docx skill to create a professional Word report with a table of contents and headings, then render it to PDF to verify the output.

Frequently Asked Questions about docx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Word document programmatically with docx-js?

Write a Node script that requires the preinstalled docx npm package and builds paragraphs, tables, and images. Watch for gotchas: page size defaults to A4, tables need columnWidths plus per-cell widths in DXA, and ImageRun requires an explicit type field.

How do I edit an existing .docx file?

docx-js cannot open existing files, so unzip the .docx, edit word/document.xml directly without reformatting, then rezip. Run merge_runs.py first so fragmented text runs become searchable, and validate the result with validate.py against the original.

How do I add tracked changes to a Word document?

Wrap inserted runs in w:ins and deleted runs in w:del elements with w:id, w:author, and w:date attributes; deleted text uses w:delText instead of w:t. Validate with validate.py --author to confirm every edit is tracked.

Why does find-and-replace fail in Word document XML?

Word splits visible text across many w:r runs due to revision IDs and spell-check markers, so phrases rarely exist as contiguous strings. The merge_runs.py script coalesces adjacent identically-formatted runs without changing rendering.

Can this skill handle PDFs or Google Docs?

No, it is scoped to .docx and .dotx files only. It can convert documents to PDF with LibreOffice for visual verification, but it does not edit PDFs, spreadsheets, or Google Docs.