docx

Create, edit, and analyze Word .docx documents using docx-js and direct XML manipulation.

320|42|Updated Feb 1, 2023
One-click install
npx skills add https://github.com/PantsForBirds/adsbee --skill docx-pantsforbirds
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/PantsForBirds/adsbee/tree/main/word
Command: npx skills add https://github.com/PantsForBirds/adsbee --skill docx-pantsforbirds

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with Word documents programmatically is error-prone: .docx files are ZIP archives of XML with strict schema rules, and common libraries have pitfalls like wrong default page sizes, broken table widths, and invalid tracked-change markup. This Skill provides tested workflows and rules for reliably creating, reading, and editing .docx files. ## Core Features & Use Cases - Create new documents: Generate polished .docx files with docx-js, including headings, tables, images, TOC, headers/footers, footnotes, hyperlinks, and multi-column layouts, with validation after generation. - Edit existing documents: Unpack the .docx, edit the XML directly (tracked changes, comments, find-and-replace, image insertion), then repack with validation and auto-repair. - Read and convert: Extract text with pandoc (including tracked changes), convert legacy .doc to .docx, and render documents to PDF or images via LibreOffice. - Use Case: A user asks for a quarterly report as a Word file with a table of contents, styled headings, a data table, and page numbers. The Skill generates it with docx-js following its critical rules (explicit US Letter size, DXA table widths, proper numbering config) and validates the output. ## Quick Start Ask the assistant to create a Word document report with a title, headings, a bulleted list, and a table, saved as a .docx file.

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 with JavaScript?

Use the docx npm library (docx-js) to build a Document object with paragraphs, tables, and images, then write it with Packer.toBuffer. Always set the page size explicitly since docx-js defaults to A4, and validate the output file afterward.

How do I edit an existing .docx file programmatically?

Unpack the .docx into its XML files, edit the document.xml directly with string replacement, then repack into a .docx. This approach supports tracked changes, comments, and image insertion that high-level libraries handle poorly.

How do I add tracked changes to a Word document?

Insert w:ins and w:del elements directly in the document XML with author and date attributes, replacing entire w:r run elements. Use w:delText instead of w:t inside deletions, and mark the paragraph mark as deleted when removing whole paragraphs.

Why do my docx-js tables render incorrectly?

Tables need dual widths: set columnWidths on the table and a matching width on every cell, always using WidthType.DXA rather than percentages which break in Google Docs. The column widths must sum exactly to the table width.

Can I convert legacy .doc files to .docx?

Yes, use LibreOffice in headless mode to convert .doc to .docx before editing. The same tool converts .docx to PDF, and pdftoppm can then render pages to images for visual inspection.

When should I not use this docx approach?

Do not use it for PDFs, spreadsheets, or Google Docs, which require different tools and formats. It is also unnecessary for simple plain-text output where Markdown suffices.