docx

Create and edit Word documents using C# OpenXML SDK and a WIR editing engine.

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill docx-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/docx
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill docx-virahitvin8

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires DocumentFormat.OpenXml, pandoc, python-docx, lxml, playwright, matplotlib, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Producing polished Word documents programmatically is error-prone: formatting gets lost when extracting text, markdown-to-docx conversions look mediocre, and OpenXML's strict element ordering causes corrupt files. This Skill routes every .docx task to the right toolchain and validates the output automatically. ## Core Features & Use Cases - Three-route workflow: WIR engine for editing existing documents (comments, tracked changes, format-preserving edits), C# + OpenXML SDK for building documents from scratch, and an md2docx pipeline for converting agent-produced Markdown with citations into footnoted Word files. - Rich document elements: native Word charts (pie, bar, line), OMML math equations, tables, footnotes, TOC field codes, headers/footers, and generated cover backgrounds via Playwright + SVG. - Built-in validation: the build pipeline compiles, auto-fixes XML element order, and runs OpenXML plus business-rule checks before delivery. - Use Case: Ask for a quarterly business report in Chinese with a cover page, TOC, charts, and page numbers — the Skill generates a validated, consistently styled .docx ready to open in Word. ## Quick Start Create a Word document report on renewable energy trends with a cover page, table of contents, and a bar chart.

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 C#?

Write a Program.cs using the DocumentFormat.OpenXml SDK and run the build command, which compiles the code, generates the document, auto-fixes XML element order, and validates the output. The Skill provides reference patterns for styles, tables, images, headers, and footers.

How do I edit an existing Word document without losing formatting?

Use the WIR editing engine rather than plain text extraction, which loses all formatting. The engine reads the document structure, applies edits, comments, or tracked changes, and validates internally after saving.

Can I convert Markdown to Word with footnotes?

Yes, the md2docx pipeline converts Markdown with citation markers into Word documents with footnotes, endnotes, or hyperlink cross-references. It requires Pandoc, python-docx, and a citation.jsonl file mapping citation IDs to URLs.

Does the docx skill support charts and math equations?

Yes, it supports native Word charts (pie, bar, line) via DrawingML chart parts and OMML math equations including fractions, radicals, summations, and matrices. For chart types Word cannot render natively, matplotlib-generated PNGs can be embedded at 300 dpi.

Why does my generated docx fail to open in Word?

Common causes include incorrect XML element ordering, missing TableGrid elements, mismatched chart axis IDs, or reusing OpenXmlElement instances across parents. The build pipeline auto-fixes element order and runs OpenXML plus business-rule validation to catch these before delivery.

Can it handle Chinese or CJK documents?

Yes, CJK documents are supported by setting the EastAsia font on every style and using a two-character first-line indent for body text. A dedicated CJKExample.cs template demonstrates the correct patterns and common C# syntax traps with Chinese punctuation.