docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of "Word doc", "word document", ".docx", or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a "report", "memo", "letter", "template", or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
Author
Category
Document ProcessingInstall
Download and extract to your skills directory
Copy command and send to OpenClaw for auto-install:
DOCX Word Document Generation and Processing
Skills Overview
Create, edit, and analyze Word documents (.docx files) using JavaScript (docx-js) or Python scripts. Full-featured support for document generation, content extraction, XML editing, table handling, image insertion, revision tracking, and more.
Applicable Scenarios
1. Automated Report and Contract Generation
Automatically generate formatted Word documents such as contracts, reports, certificates, etc. Supports custom page sizes, headers and footers, tables of contents, table styles, and more, enabling templated bulk production without manual use of Microsoft Word.
2. Batch Document Processing
Perform batch edits on existing Word documents, including text replacement, revision handling, content extraction, and more. Suitable for scenarios requiring uniform processing of large numbers of documents, such as company document standardization and annotation aggregation.
3. Document Format Conversion and Analysis
Convert Word documents to other formats (such as PDF or images), extract document content and structural information, and analyze revisions and comments. Useful for document management systems and content migration projects.
Core Features
1. Create New Documents
Use the docx-js library to create Word documents from scratch, supporting paragraphs, headings, lists, tables, images, headers and footers, table of contents, and all common elements. Precisely control page size, margins, fonts, colors, and other formatting attributes. The generated documents are fully compatible with Microsoft Word.
2. Edit Existing Documents
Unpack .docx files and edit the underlying XML directly to achieve precise content modifications. Support adding revision tracking, inserting comments, replacing text, modifying styles, and more. Repackaging preserves document structure and formatting.
3. Content Extraction and Conversion
Use pandoc or custom scripts to extract plain text content from Word documents, with options to preserve or ignore revision information. Convert Word documents to PDF, Markdown, images, and other formats for easier distribution and archiving.
Frequently Asked Questions
How do I create a Word document with JavaScript?
You can create Word documents using the docx-js library. First install with
npm install -g docx, then construct the document structure using Document, Paragraph, Table, and other components, and finally generate a .docx file with Packer. It supports setting page size, styles, tables, images, and all common features.How compatible are documents generated by docx-js?
Documents generated by docx-js follow the Office Open XML standard and are fully compatible with mainstream office software such as Microsoft Word, Google Docs, and LibreOffice. It is recommended to run validation scripts after generation to check the document structure and ensure correct display across platforms.
How do I edit an existing .docx file?
Editing an existing document involves three steps: first unpack to obtain the XML files, then directly edit files like document.xml to modify content (supporting additions like revisions and comments), and finally repackage into a .docx. The unpacking process will automatically merge adjacent text runs and convert smart quotes to facilitate editing.