minimax-docx

Create, edit, and format DOCX documents using OpenXML SDK with validation pipelines.

1|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/qfwc258/trae-skills --skill minimax-docx-qfwc258
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: minimax-docx
Source: https://github.com/qfwc258/trae-skills/tree/main/minimax-docx
Command: npx skills add https://github.com/qfwc258/trae-skills --skill minimax-docx-qfwc258

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires DocumentFormat.OpenXml, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Producing professional Word documents programmatically is error-prone: OpenXML has strict element ordering rules, direct formatting contaminates template styles, and CJK typography follows different conventions. This Skill provides tested pipelines and verified code patterns to create, edit, and reformat .docx files without corrupting them. ## Core Features & Use Cases - Three document pipelines: create new documents from scratch, fill or edit content in existing .docx files, and apply template formatting with a mandatory XSD gate-check validation. - CLI plus direct C# path: use the MiniMaxAIDocx CLI for simple tasks (text replacement, placeholder filling, table filling) or write C# against DocumentFormat.OpenXml for structural work like multi-section layouts, TOC, headers/footers, and images. - Design knowledge base: 13 aesthetic recipes from authoritative sources (IEEE, ACM, APA, MLA, Chicago, Springer LNCS, Nature, GB/T 9704 Chinese government standard) plus CJK typography and Chinese university thesis template guides. - Use Case: A user asks to reformat their thesis draft to match their university's template. The Skill routes to Pipeline C, copies the template as the base preserving all sections and headers, replaces the example content, then runs XSD validation and a business-rules gate-check before delivery. ## Quick Start Ask the assistant to create a formatted Word report or apply your template to an existing document, and it will run the setup script, pick the right pipeline, and validate the output before delivering the .docx file.

Frequently Asked Questions about minimax-docx

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

FAQPage Schema
How do I create a Word document programmatically with OpenXML?

Use DocumentFormat.OpenXml to create a WordprocessingDocument, add a MainDocumentPart with a Document and Body, then append paragraphs and tables. This Skill provides a C# scaffold and compilable sample files covering styles, tables, images, and TOC generation.

How do I apply a Word template to an existing document?

Use the apply-template CLI command with the source and template .docx files. For templates with structure like covers and example sections, use the base-replace approach: copy the template as the output base and replace its example content, preserving all sections and headers.

Why does my OpenXML document get corrupted after editing?

Corruption usually comes from violating OpenXML element ordering rules, such as placing runs before paragraph properties or omitting sectPr as the last body child. Run the fix-order command followed by XSD validation to auto-repair ordering issues.

Does OpenXML support Chinese fonts and CJK typography?

Yes, set the w:eastAsia attribute on RunFonts to control CJK fonts independently from Latin fonts. The Skill includes guides for GB/T 9704 government documents, Chinese thesis templates, first-line character indentation, and emphasis dots instead of italic.

Why is my Word table of contents empty after generating headings?

Heading styles must include an OutlineLevel property in their StyleParagraphProperties, with H1 set to 0, H2 to 1, and so on. Without it, Word treats headings as plain styled text and the TOC field finds nothing to list.

What are the limitations of the CLI versus writing C# directly?

The CLI handles simple operations like text replacement, placeholder filling, and basic document creation. Structural work such as multi-template merges, per-section headers, complex tables, and image insertion requires writing C# directly against the OpenXML SDK.