Word documents
Setup
Set SKILL_DIR to the absolute directory containing this file. All command paths
are relative to this directory, not the task's working directory.
First DOCX operation in the session:
bash "$SKILL_DIR/scripts/env_check.sh". Reuse the working SDK and CLI afterward.
For permitted missing dependencies, use scripts/setup.sh --minimal (Windows:
scripts/setup.ps1 -Minimal). For PDF output, .doc conversion or requested
rendering, run bash "$SKILL_DIR/scripts/env_check.sh" --with-rendering; it probes
Writer with a real DOCX-to-PDF conversion. If needed and setup is allowed, run the
full setup script without the minimal flag. Do not equate a binary/version probe
with successful candidate rendering.
Routing order: common → applicable profile → operation
- For a narrow EDIT or read-only task, preserve existing presentation:
use B for edits and preview/analyze for reading; never recreate or restyle
merely because text mentions APA, 公文 or HBR.
- Treat explicit user requirements and the supplied template as authoritative.
If they conflict, clarify rather than silently replacing either with a recipe.
- For new creation or explicitly requested restyling, select an applicable
profile. Named-format rules override generic academic/business defaults, not
the user's requirements or template.
- Select A/B/C below. New content in a supplied structured template uses C-2
Base-Replace; a simple fill remains B.
| Condition (within the authorized scope) |
Read directly |
| Chinese government / 公文 / GB/T 9704 layout |
Government |
| Named paper: IEEE, ACM, APA, MLA, Chicago/Turabian, LNCS, Nature |
Academic |
| Thesis/dissertation or supplied university template |
Thesis/template |
| Corporate report, executive brief, HBR or editorial presentation |
Business/editorial |
| Generic memo, letter or unspecified layout; narrow edit/read |
No domain recipe required |
Profiles address structure/presentation, not research, government, legal or
business expertise or official certification. Adapt examples to the supplied
content; never copy sample findings, citations, agency identities or business
data. Samples are not CLI recipe selectors or publisher acceptance guarantees.
Pipeline routing
| Task |
Workflow |
| New document without a structured template |
Pipeline A: CREATE |
| Fill placeholders, replace text or edit authorized content |
Pipeline B: EDIT/FILL |
| Authorized restyling with a pure style template |
Pipeline C-1: OVERLAY |
| New content within a structured cover/TOC/section template |
Pipeline C-2: BASE-REPLACE |
| Completed output or an affected change |
VALIDATE |
For existing documents, preview and analyze before editing. Convert legacy .doc
only when needed; these entry points remain unchanged:
bash "$SKILL_DIR/scripts/doc_to_docx.sh" input.doc output_dir/
bash "$SKILL_DIR/scripts/docx_preview.sh" document.docx
bash "$SKILL_DIR/scripts/docx.sh" analyze --input document.docx
bash "$SKILL_DIR/scripts/docx.sh" --help
Simple CLI creation supports report|letter|memo|academic; --type academic is
not APA/IEEE selection. For custom styles, sections, TOC, images or complex
tables, read authoring and sample patterns
and the relevant actual C# sample before implementing. Compose operations only
as requested, then validate the completed file. For Word plus PDF, render that
DOCX rather than independently redesigning its companion.
References by responsibility
Each format uses references/common/, domains/, operations/ and
implementation/. Select only applicable guides; do not load the whole library.
For long guides, use their headings/contents or search for the needed element or
symptom. The operation owns the workflow, profiles own named requirements, and
implementation guides own SDK/package details. Executable and asset paths stay
under scripts/ and assets/.
| Need |
Direct reference |
| Fonts, sizes, page/table design |
Presentation |
| CJK fonts, 字号, RunFonts and scoped GB/T layout |
CJK typography |
| Hierarchy, spacing, contrast and alignment |
Design principles |
| Visual mistakes and corrections |
Design examples |
| C# project scaffold, sample index and corruption-prevention rules |
Authoring |
| Element ordering |
Element order |
| DXA, EMU and half-point conversion |
Units |
| XML namespace details |
Namespaces |
| Document creation, styles, runs and paragraphs |
OpenXML part 1 |
| Pages, tables, headers/footers and sections |
OpenXML part 2 |
| TOC, fields, revisions, comments, images, math and numbering |
OpenXML part 3 |
| Numeric thesis style IDs, zones and template preservation |
University templates |
| Revision markup |
Track changes |
| Comment package parts |
Comments |
| Package/business/subset validation boundaries |
Validation details |
| Visible symptoms and targeted fixes |
Troubleshooting |
1---2name: docx3license: MIT4metadata:5 source: https://skillmd.com/skills/vm0-ai/docx6 version: "1.0.0"7 category: document-processing8 upstream: UPSTREAM.md9 sources:10 - "ECMA-376 Office Open XML File Formats"11 - "GB/T 9704-2012 Layout Standard for Official Documents"12 - "IEEE / ACM / APA / MLA / Chicago / Turabian Style Guides"13 - "Springer LNCS / Nature / HBR Document Templates"14description: >15 Create, read, edit, fill, and format editable Word documents (.docx / Word文档 / 文档)16 using OpenXML SDK (.NET). Use for reports/报告, proposals, memos, forms, contract17 formatting/合同, Chinese government documents/公文 (GB/T 9704), academic papers18 (IEEE, ACM, APA 7 professional, MLA 9, Chicago/Turabian, Springer LNCS, Nature),19 theses/学位论文 and supplied university templates, business/editorial formats20 (Modern Corporate, Executive Brief, HBR), 排版 and 套模板. Route creation,21 narrow content edits, or template application without assuming a restyle.22 Provides document structure and presentation guidance, not government-policy,23 research, or legal expertise or official certification. Use ../pdf/SKILL.md24 for a standalone PDF.25---2627# Word documents2829## Setup3031Set `SKILL_DIR` to the absolute directory containing this file. All command paths32are relative to this directory, not the task's working directory.3334First DOCX operation in the session:35`bash "$SKILL_DIR/scripts/env_check.sh"`. Reuse the working SDK and CLI afterward.36For permitted missing dependencies, use `scripts/setup.sh --minimal` (Windows:37`scripts/setup.ps1 -Minimal`). For PDF output, `.doc` conversion or requested38rendering, run `bash "$SKILL_DIR/scripts/env_check.sh" --with-rendering`; it probes39Writer with a real DOCX-to-PDF conversion. If needed and setup is allowed, run the40full setup script without the minimal flag. Do not equate a binary/version probe41with successful candidate rendering.4243## Routing order: common → applicable profile → operation44451. For a **narrow EDIT** or **read-only** task, preserve existing presentation:46 use B for edits and preview/analyze for reading; never recreate or restyle47 merely because text mentions APA, 公文 or HBR.482. Treat explicit user requirements and the supplied template as authoritative.49 If they conflict, clarify rather than silently replacing either with a recipe.503. For **new creation or explicitly requested restyling**, select an applicable51 profile. Named-format rules override generic academic/business defaults, not52 the user's requirements or template.534. Select A/B/C below. New content in a supplied structured template uses C-254 Base-Replace; a simple fill remains B.5556| Condition (within the authorized scope) | Read directly |57|---|---|58| Chinese government / 公文 / GB/T 9704 layout | [Government](references/domains/government.md) |59| Named paper: IEEE, ACM, APA, MLA, Chicago/Turabian, LNCS, Nature | [Academic](references/domains/academic.md) |60| Thesis/dissertation or supplied university template | [Thesis/template](references/domains/thesis-template.md) |61| Corporate report, executive brief, HBR or editorial presentation | [Business/editorial](references/domains/business-editorial.md) |62| Generic memo, letter or unspecified layout; narrow edit/read | No domain recipe required |6364Profiles address structure/presentation, not research, government, legal or65business expertise or official certification. Adapt examples to the supplied66content; never copy sample findings, citations, agency identities or business67data. Samples are not CLI recipe selectors or publisher acceptance guarantees.6869## Pipeline routing7071| Task | Workflow |72|---|---|73| New document without a structured template | Pipeline A: [CREATE](references/operations/create.md) |74| Fill placeholders, replace text or edit authorized content | Pipeline B: [EDIT/FILL](references/operations/edit.md) |75| Authorized restyling with a pure style template | Pipeline C-1: [OVERLAY](references/operations/template.md) |76| New content within a structured cover/TOC/section template | Pipeline C-2: [BASE-REPLACE](references/operations/template.md) |77| Completed output or an affected change | [VALIDATE](references/operations/validate.md) |7879For existing documents, preview and analyze before editing. Convert legacy `.doc`80only when needed; these entry points remain unchanged:8182```bash83bash "$SKILL_DIR/scripts/doc_to_docx.sh" input.doc output_dir/84bash "$SKILL_DIR/scripts/docx_preview.sh" document.docx85bash "$SKILL_DIR/scripts/docx.sh" analyze --input document.docx86bash "$SKILL_DIR/scripts/docx.sh" --help87```8889Simple CLI creation supports `report|letter|memo|academic`; `--type academic` is90not APA/IEEE selection. For custom styles, sections, TOC, images or complex91tables, read [authoring and sample patterns](references/implementation/authoring.md)92and the relevant actual C# sample before implementing. Compose operations only93as requested, then validate the completed file. For Word plus PDF, render that94DOCX rather than independently redesigning its companion.9596## References by responsibility9798Each format uses `references/common/`, `domains/`, `operations/` and99`implementation/`. Select only applicable guides; do not load the whole library.100For long guides, use their headings/contents or search for the needed element or101symptom. The operation owns the workflow, profiles own named requirements, and102implementation guides own SDK/package details. Executable and asset paths stay103under `scripts/` and `assets/`.104105| Need | Direct reference |106|---|---|107| Fonts, sizes, page/table design | [Presentation](references/common/presentation.md) |108| CJK fonts, 字号, RunFonts and scoped GB/T layout | [CJK typography](references/common/cjk-typography.md) |109| Hierarchy, spacing, contrast and alignment | [Design principles](references/common/design-principles.md) |110| Visual mistakes and corrections | [Design examples](references/common/design-examples.md) |111| C# project scaffold, sample index and corruption-prevention rules | [Authoring](references/implementation/authoring.md) |112| Element ordering | [Element order](references/implementation/element-order.md) |113| DXA, EMU and half-point conversion | [Units](references/implementation/units.md) |114| XML namespace details | [Namespaces](references/implementation/namespaces.md) |115| Document creation, styles, runs and paragraphs | [OpenXML part 1](references/implementation/openxml-part-1.md) |116| Pages, tables, headers/footers and sections | [OpenXML part 2](references/implementation/openxml-part-2.md) |117| TOC, fields, revisions, comments, images, math and numbering | [OpenXML part 3](references/implementation/openxml-part-3.md) |118| Numeric thesis style IDs, zones and template preservation | [University templates](references/implementation/university-template.md) |119| Revision markup | [Track changes](references/implementation/track-changes.md) |120| Comment package parts | [Comments](references/implementation/comments.md) |121| Package/business/subset validation boundaries | [Validation details](references/implementation/validation.md) |122| Visible symptoms and targeted fixes | [Troubleshooting](references/implementation/troubleshooting.md) |