Word documents
Pipeline routing
| Task | Workflow |
|---|---|
| New document without a structured supplied template | Pipeline A: CREATE, using the CLI for supported blocks/options |
| Fill placeholders, replace text or edit authorized content | Pipeline B: EDIT/FILL |
| Read or analyze an existing document | Use preview/analyze below; preserve the file |
| 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 DOCX-only delivery, validate the final file with the script and skip
rendering and visual review when it contains no images or tables and the
task does not require visual verification. Set SKILL_DIR as described
in Setup and run:
bash "$SKILL_DIR/scripts/docx.sh" validate --input doc.docx --document-rules
Follow the user's requirements and supplied template. Preserve existing
presentation for narrow edits and read-only work; a mention of APA, 公文 or HBR
does not by itself authorize restyling. Clarify conflicting requirements.
For a new report, letter, memo or generic academic document without a named
presentation, use the standard CLI route in CREATE and its validation guide.
A request for a report or proposal does not select a named business recipe.
Load additional presentation or SDK references only for requirements outside
that route.
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". Bash entrypoints reuse installed .NET;
a built CLI needs only the .NET 8 runtime.
For permitted missing authoring dependencies, use scripts/setup.sh --minimal
(Windows: scripts/setup.ps1 -Minimal).
For requested PDF output or rendered visual review, the rendering command
automatically provisions unavailable converters where installation is permitted.
To prepare them before authoring, optionally run
python3 "$SKILL_DIR/scripts/render_docx.py" --prepare.
Add --pages qa/pages when page images are needed. Render the validated DOCX
using the rendering instructions.
Named presentation profiles
Read a profile when the user requests its named format or supplies a template
that requires it. Apply those requirements before generic defaults; use the
operation selected above to preserve or create the required structure.
| Requested format | Read directly |
|---|---|
| Chinese government / 公文 / GB/T 9704 layout | Government |
| IEEE, ACM, APA, MLA, Chicago/Turabian, LNCS, Nature | Academic |
| Thesis/dissertation or supplied university template | Thesis/template |
| Modern Corporate, Executive Brief, Minimal Modern or HBR presentation | Business/editorial |
Profiles address structure/presentation, not domain expertise or certification.
When a named profile or custom layout exceeds the CLI's supported blocks and
options, use the relevant C# authoring pattern.
Adapt samples to the task; never copy their findings, citations or identities.
Existing documents
Preview and analyze before editing. Convert legacy .doc only when needed:
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
References by responsibility
Select only applicable guides; do not load the whole library. For long guides,
search for the needed element or symptom. Operations own 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 |
|---|---|
| Custom 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 |