minimax-docx

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

minimax-docx

minimax-docx

Create, edit, and format DOCX documents via CLI tools or direct C# scripts built on OpenXML SDK (.NET).
通过CLI工具或基于OpenXML SDK(.NET)编写的C#脚本,创建、编辑和格式化DOCX文档。

Setup

环境搭建

First time:
bash scripts/setup.sh
(or
powershell scripts/setup.ps1
on Windows,
--minimal
to skip optional deps).
First operation in session:
scripts/env_check.sh
— do not proceed if
NOT READY
. (Skip on subsequent operations within the same session.)
首次使用: 执行
bash scripts/setup.sh
(Windows系统请执行
powershell scripts/setup.ps1
,添加
--minimal
参数可跳过可选依赖安装)。
会话内首次操作: 执行
scripts/env_check.sh
——若输出为
NOT READY
,请勿继续操作。(同一会话内后续操作可跳过此步骤。)

Quick Start: Direct C# Path

快速入门:直接使用C#方式

When the task requires structural document manipulation (custom styles, complex tables, multi-section layouts, headers/footers, TOC, images), write C# directly instead of wrestling with CLI limitations. Use this scaffold:
csharp
// File: scripts/dotnet/task.csx  (or a new .cs in a Console project)
// dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli -- run-script task.csx
#r "nuget: DocumentFormat.OpenXml, 3.2.0"

using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;

using var doc = WordprocessingDocument.Create("output.docx", WordprocessingDocumentType.Document);
var mainPart = doc.AddMainDocumentPart();
mainPart.Document = new Document(new Body());

// --- Your logic here ---
// Read the relevant Samples/*.cs file FIRST for tested patterns.
// See Samples/ table in References section below.
Before writing any C#, read the relevant
Samples/*.cs
file
— they contain compilable, SDK-version-verified patterns. The Samples table in the References section below maps topics to files.
当任务需要对文档进行结构化操作(自定义样式、复杂表格、多节布局、页眉/页脚、目录、图片插入等)时,请直接编写C#代码,无需受限于CLI的功能局限。使用以下脚手架:
csharp
// 文件路径:scripts/dotnet/task.csx (或在控制台项目中新建.cs文件)
// 执行命令:dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli -- run-script task.csx
#r "nuget: DocumentFormat.OpenXml, 3.2.0"

using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;

using var doc = WordprocessingDocument.Create("output.docx", WordprocessingDocumentType.Document);
var mainPart = doc.AddMainDocumentPart();
mainPart.Document = new Document(new Body());

// --- 在此处编写你的逻辑 ---
// 请先阅读相关Samples/*.cs文件,参考经过验证的实现模式。
// 可参考下方参考资料中的Samples表格。
编写C#代码前,请务必先阅读对应的
Samples/*.cs
文件
——这些文件包含可编译、经过SDK版本验证的实现模式。

CLI shorthand

CLI快捷命令

All CLI commands below use
$CLI
as shorthand for:
bash
dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli --
以下所有CLI命令均使用
$CLI
作为缩写,完整命令为:
bash
dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli --

Pipeline routing

流程路由判断

Route by checking: does the user have an input .docx file?
User task
├─ No input file → Pipeline A: CREATE
│   signals: "write", "create", "draft", "generate", "new", "make a report/proposal/memo"
│   → Read references/scenario_a_create.md
└─ Has input .docx
    ├─ Replace/fill/modify content → Pipeline B: FILL-EDIT
    │   signals: "fill in", "replace", "update", "change text", "add section", "edit"
    │   → Read references/scenario_b_edit_content.md
    └─ Reformat/apply style/template → Pipeline C: FORMAT-APPLY
        signals: "reformat", "apply template", "restyle", "match this format", "套模板", "排版"
        ├─ Template is pure style (no content) → C-1: OVERLAY (apply styles to source)
        └─ Template has structure (cover/TOC/example sections) → C-2: BASE-REPLACE
            (use template as base, replace example content with user content)
        → Read references/scenario_c_apply_template.md
If the request spans multiple pipelines, run them sequentially (e.g., Create then Format-Apply).
根据用户是否提供输入.docx文件,选择对应的处理流程:
用户任务
├─ 无输入文件 → 流程A:创建文档
│   触发关键词:"撰写"、"创建"、"起草"、"生成"、"新建"、"制作报告/提案/备忘录"
│   → 阅读参考文档references/scenario_a_create.md
└─ 有输入.docx文件
    ├─ 替换/填充/修改内容 → 流程B:填充与编辑
    │   触发关键词:"填写"、"替换"、"更新"、"修改文本"、"添加章节"、"编辑"
    │   → 阅读参考文档references/scenario_b_edit_content.md
    └─ 重新格式化/应用样式/模板 → 流程C:格式应用
        触发关键词:"重新排版"、"应用模板"、"修改样式"、"匹配此格式"、"套模板"、"排版"
        ├─ 模板仅包含样式(无内容) → C-1:覆盖模式(将样式应用到源文档)
        └─ 模板包含结构(封面/目录/示例章节) → C-2:基础替换模式
            (以模板为基础,将示例内容替换为用户提供的内容)
        → 阅读参考文档references/scenario_c_apply_template.md
若用户请求涉及多个流程,请按顺序依次执行(例如:先创建文档,再应用格式)。

Pre-processing

预处理操作

Convert
.doc
.docx
if needed:
scripts/doc_to_docx.sh input.doc output_dir/
Preview before editing (avoids reading raw XML):
scripts/docx_preview.sh document.docx
Analyze structure for editing scenarios:
$CLI analyze --input document.docx
若需要将
.doc
格式转换为
.docx
:执行
scripts/doc_to_docx.sh input.doc output_dir/
编辑前预览文档(避免直接读取原始XML):执行
scripts/docx_preview.sh document.docx
分析文档结构(适用于编辑场景):执行
$CLI analyze --input document.docx

Scenario A: Create

场景A:创建文档

Read
references/scenario_a_create.md
,
references/typography_guide.md
, and
references/design_principles.md
first. Pick an aesthetic recipe from
Samples/AestheticRecipeSamples.cs
that matches the document type — do not invent formatting values. For CJK, also read
references/cjk_typography.md
.
Choose your path:
  • Simple (plain text, minimal formatting): use CLI —
    $CLI create --type report --output out.docx --config content.json
  • Structural (custom styles, multi-section, TOC, images, complex tables): write C# directly. Read the relevant
    Samples/*.cs
    first.
CLI options:
--type
(report|letter|memo|academic),
--title
,
--author
,
--page-size
(letter|a4|legal|a3),
--margins
(standard|narrow|wide),
--header
,
--footer
,
--page-numbers
,
--toc
,
--content-json
.
Then run the validation pipeline (below).
请先阅读
references/scenario_a_create.md
references/typography_guide.md
references/design_principles.md
。从
Samples/AestheticRecipeSamples.cs
中选择与文档类型匹配的排版方案——请勿自行定义格式参数。若处理CJK(中日韩)文档,还需阅读
references/cjk_typography.md
选择实现方式:
  • 简单场景(纯文本、 minimal格式):使用CLI命令——
    $CLI create --type report --output out.docx --config content.json
  • 结构化场景(自定义样式、多节布局、目录、图片、复杂表格):直接编写C#代码。请先阅读对应的
    Samples/*.cs
    文件。
CLI可选参数:
--type
(可选值:report|letter|memo|academic)、
--title
--author
--page-size
(可选值:letter|a4|legal|a3)、
--margins
(可选值:standard|narrow|wide)、
--header
--footer
--page-numbers
--toc
--content-json
完成后执行校验流程(见下文)。

Scenario B: Edit / Fill

场景B:编辑/填充文档

Read
references/scenario_b_edit_content.md
first. Preview → analyze → edit → validate.
Choose your path:
  • Simple (text replacement, placeholder fill): use CLI subcommands.
  • Structural (add/reorganize sections, modify styles, manipulate tables, insert images): write C# directly. Read
    references/openxml_element_order.md
    and the relevant
    Samples/*.cs
    .
Available CLI edit subcommands:
  • replace-text --find "X" --replace "Y"
  • fill-placeholders --data '{"key":"value"}'
  • fill-table --data table.json
  • insert-section
    ,
    remove-section
    ,
    update-header-footer
bash
$CLI edit replace-text --input in.docx --output out.docx --find "OLD" --replace "NEW"
$CLI edit fill-placeholders --input in.docx --output out.docx --data '{"name":"John"}'
Then run the validation pipeline. Also run diff to verify minimal changes:
bash
$CLI diff --before in.docx --after out.docx
请先阅读
references/scenario_b_edit_content.md
。操作流程:预览 → 分析 → 编辑 → 校验。
选择实现方式:
  • 简单场景(文本替换、占位符填充):使用CLI子命令。
  • 结构化场景(添加/重组章节、修改样式、操作表格、插入图片):直接编写C#代码。请阅读
    references/openxml_element_order.md
    和对应的
    Samples/*.cs
    文件。
可用的CLI编辑子命令:
  • replace-text --find "X" --replace "Y"
  • fill-placeholders --data '{"key":"value"}'
  • fill-table --data table.json
  • insert-section
    ,
    remove-section
    ,
    update-header-footer
bash
$CLI edit replace-text --input in.docx --output out.docx --find "OLD" --replace "NEW"
$CLI edit fill-placeholders --input in.docx --output out.docx --data '{"name":"John"}'
完成后执行校验流程,并通过对比验证修改内容:
bash
$CLI diff --before in.docx --after out.docx

Scenario C: Apply Template

场景C:应用模板

Read
references/scenario_c_apply_template.md
first. Preview and analyze both source and template.
bash
$CLI apply-template --input source.docx --template template.docx --output out.docx
For complex template operations (multi-template merge, per-section headers/footers, style merging), write C# directly — see Critical Rules below for required patterns.
Run the validation pipeline, then the hard gate-check:
bash
$CLI validate --input out.docx --gate-check assets/xsd/business-rules.xsd
Gate-check is a hard requirement. Do NOT deliver until it passes. If it fails: diagnose, fix, re-run.
Also diff to verify content preservation:
$CLI diff --before source.docx --after out.docx
请先阅读
references/scenario_c_apply_template.md
。预览并分析源文档与模板文档。
bash
$CLI apply-template --input source.docx --template template.docx --output out.docx
对于复杂的模板操作(多模板合并、按章节设置页眉/页脚、样式合并等),请直接编写C#代码——请参考下文“关键规则”中的必填实现模式。
完成后执行校验流程,再执行强制关卡校验
bash
$CLI validate --input out.docx --gate-check assets/xsd/business-rules.xsd
关卡校验为强制要求,未通过校验前请勿交付文档。若校验失败:排查问题、修复后重新执行校验。
同时通过对比验证内容是否完整保留:
$CLI diff --before source.docx --after out.docx

Validation pipeline

校验流程

Run after every write operation. For Scenario C the full pipeline is mandatory; for A/B it is recommended (skip only if the operation was trivially simple).
bash
$CLI merge-runs --input doc.docx                                    # 1. consolidate runs
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsd     # 2. XSD structure
$CLI validate --input doc.docx --business                           # 3. business rules
If XSD fails, auto-repair and retry:
bash
$CLI fix-order --input doc.docx
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsd
If XSD still fails, fall back to business rules + preview:
bash
$CLI validate --input doc.docx --business
scripts/docx_preview.sh doc.docx
每次写入操作后均需执行此流程。对于场景C,完整校验流程为强制要求;对于场景A/B,建议执行(仅当操作极为简单时可跳过)。
bash
$CLI merge-runs --input doc.docx                                    # 1. 合并连续文本段
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsd     # 2. XSD结构校验
$CLI validate --input doc.docx --business                           # 3. 业务规则校验
若XSD校验失败,自动修复后重试:
bash
$CLI fix-order --input doc.docx
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsd
若XSD校验仍失败,可仅执行业务规则校验并预览文档:
bash
$CLI validate --input doc.docx --business
scripts/docx_preview.sh doc.docx

Verify: font contamination=0, table count correct, drawing count correct, sectPr count correct

手动验证:字体污染=0、表格数量正确、图片数量正确、章节属性数量正确


Final preview: `scripts/docx_preview.sh doc.docx`

最终预览:执行`scripts/docx_preview.sh doc.docx`

Critical rules

关键规则

These prevent file corruption — OpenXML is strict about element ordering.
Element order (properties always first):
ParentOrder
w:p
pPr
→ runs
w:r
rPr
t
/
br
/
tab
w:tbl
tblPr
tblGrid
tr
w:tr
trPr
tc
w:tc
tcPr
p
(min 1
<w:p/>
)
w:body
block content →
sectPr
(LAST child)
Direct format contamination: When copying content from a source document, inline
rPr
(fonts, color) and
pPr
(borders, shading, spacing) override template styles. Always strip direct formatting — keep only
pStyle
reference and
t
text. Clean tables too (including
pPr/rPr
inside cells).
Track changes:
<w:del>
uses
<w:delText>
, never
<w:t>
.
<w:ins>
uses
<w:t>
, never
<w:delText>
.
Font size:
w:sz
= points × 2 (12pt →
sz="24"
). Margins/spacing in DXA (1 inch = 1440, 1cm ≈ 567).
Heading styles MUST have OutlineLevel: When defining heading styles (Heading1, ThesisH1, etc.), always include
new OutlineLevel { Val = N }
in
StyleParagraphProperties
(H1→0, H2→1, H3→2). Without this, Word sees them as plain styled text — TOC and navigation pane won't work.
Multi-template merge: When given multiple template files (font, heading, breaks), read
references/scenario_c_apply_template.md
section "Multi-Template Merge" FIRST. Key rules:
  • Merge styles from all templates into one styles.xml. Structure (sections/breaks) comes from the breaks template.
  • Each content paragraph must appear exactly ONCE — never duplicate when inserting section breaks.
  • NEVER insert empty/blank paragraphs as padding or section separators. Output paragraph count must equal input. Use section break properties (
    w:sectPr
    inside
    w:pPr
    ) and style spacing (
    w:spacing
    before/after) for visual separation.
  • Insert oddPage section breaks before EVERY chapter heading, not just the first. Even if a chapter has dual-column content, it MUST start with oddPage; use a second continuous break after the heading for column switching.
  • Dual-column chapters need THREE section breaks: (1) oddPage in preceding para's pPr, (2) continuous+cols=2 in the chapter HEADING's pPr, (3) continuous+cols=1 in the last body para's pPr to revert.
  • Copy
    titlePg
    settings from the breaks template for EACH section. Abstract and TOC sections typically need
    titlePg=true
    .
Multi-section headers/footers: Templates with 10+ sections (e.g., Chinese thesis) have DIFFERENT headers/footers per section (Roman vs Arabic page numbers, different header text per zone). Rules:
  • Use C-2 Base-Replace: copy the TEMPLATE as output base, then replace body content. This preserves all sections, headers, footers, and titlePg settings automatically.
  • NEVER recreate headers/footers from scratch — copy template header/footer XML byte-for-byte.
  • NEVER add formatting (borders, alignment, font size) not present in the template header XML.
  • Non-cover sections MUST have header/footer XML files (at least empty header + page number footer).
  • See
    references/scenario_c_apply_template.md
    section "Multi-Section Header/Footer Transfer".
以下规则可避免文件损坏——OpenXML对元素顺序有严格要求。
元素顺序(属性必须放在最前面):
父元素顺序
w:p
pPr
→ 文本段
w:r
rPr
t
/
br
/
tab
w:tbl
tblPr
tblGrid
tr
w:tr
trPr
tc
w:tc
tcPr
p
(至少包含一个
<w:p/>
w:body
块级内容 →
sectPr
(最后一个子元素)
直接格式污染: 从源文档复制内容时,内联的
rPr
(字体、颜色)和
pPr
(边框、底纹、间距)会覆盖模板样式。请务必清除直接格式——仅保留
pStyle
引用和
t
文本内容。表格也需要清理(包括单元格内的
pPr/rPr
)。
修订跟踪:
<w:del>
元素必须使用
<w:delText>
,禁止使用
<w:t>
<w:ins>
元素必须使用
<w:t>
,禁止使用
<w:delText>
字体大小:
w:sz
的值为磅数×2(例如12磅对应
sz="24"
)。边距/间距单位为DXA(1英寸=1440 DXA,1厘米≈567 DXA)。
标题样式必须包含OutlineLevel: 定义标题样式(Heading1、ThesisH1等)时,必须在
StyleParagraphProperties
中添加
new OutlineLevel { Val = N }
(H1对应0,H2对应1,H3对应2)。若缺少此设置,Word会将其视为普通样式文本——目录和导航窗格将无法正常识别。
多模板合并: 当提供多个模板文件(字体、标题、分页符)时,请先阅读
references/scenario_c_apply_template.md
中的“Multi-Template Merge”章节。核心规则:
  • 将所有模板的样式合并到一个styles.xml中。文档结构(章节/分页符)取自分页符模板。
  • 每个内容段落必须仅出现一次——插入章节分页符时禁止重复内容。
  • 禁止插入空段落作为填充或章节分隔符。输出文档的段落数量必须与输入文档一致。请使用章节分页符属性(
    w:pPr
    内的
    w:sectPr
    )和样式间距(
    w:spacing
    的before/after属性)实现视觉分隔。
  • 每个章节标题前必须插入oddPage类型的章节分页符,而非仅在第一个章节前插入。即使章节内容为双栏布局,也必须以oddPage分页符开头;在标题后插入第二个continuous类型的分页符以切换为双栏布局。
  • 双栏章节需要三个章节分页符:(1) 前一段落的pPr中添加oddPage分页符,(2) 章节标题的pPr中添加continuous+cols=2分页符,(3) 最后一个正文段落的pPr中添加continuous+cols=1分页符以恢复单栏布局。
  • 从分页符模板中复制
    titlePg
    设置到每个章节。摘要和目录章节通常需要设置
    titlePg=true
多章节页眉/页脚: 包含10个以上章节的模板(例如中文毕业论文),每个章节的页眉/页脚可能不同(罗马数字vs阿拉伯数字页码、不同区域的页眉文本)。规则:
  • 使用C-2基础替换模式:将模板复制为输出文档的基础,再替换正文内容。这样可自动保留所有章节、页眉、页脚和titlePg设置。
  • 禁止从头开始重建页眉/页脚——请逐字节复制模板中的页眉/页脚XML内容。
  • 禁止添加模板页眉XML中未包含的格式(边框、对齐方式、字体大小等)。
  • 非封面章节必须包含页眉/页脚XML文件(至少包含空页眉和带页码的页脚)。
  • 请参考
    references/scenario_c_apply_template.md
    中的“Multi-Section Header/Footer Transfer”章节。

References

参考资料

Load as needed — don't load all at once. Pick the most relevant files for the task.
The C# samples and design references below are the project's knowledge base ("encyclopedia"). When writing OpenXML code, ALWAYS read the relevant sample file first — it contains compilable, SDK-version-verified patterns that prevent common errors. When making aesthetic decisions, read the design principles and recipe files — they encode tested, harmonious parameter sets from authoritative sources (IEEE, ACM, APA, Nature, etc.), not guesses.
按需加载——无需一次性加载所有资料。请选择与当前任务最相关的文件。
以下C#示例和设计参考是本项目的知识库(“百科全书”)。 编写OpenXML代码时,务必先阅读对应的示例文件——其中包含可编译、经过SDK版本验证的实现模式,可避免常见错误。进行排版决策时,请阅读设计原则和方案文件——这些文件包含来自权威机构(IEEE、ACM、APA、Nature等)的经过验证的协调参数集,而非主观猜测。

Scenario guides (read first for each pipeline)

场景指南(每个流程请先阅读对应指南)

FileWhen
references/scenario_a_create.md
Pipeline A: creating from scratch
references/scenario_b_edit_content.md
Pipeline B: editing existing content
references/scenario_c_apply_template.md
Pipeline C: applying template formatting
文件适用场景
references/scenario_a_create.md
流程A:从零创建文档
references/scenario_b_edit_content.md
流程B:编辑现有内容
references/scenario_c_apply_template.md
流程C:应用模板格式

C# code samples (compilable, heavily commented — read when writing code)

C#代码示例(可编译、带有详细注释——编写代码时请阅读)

FileTopic
Samples/DocumentCreationSamples.cs
Document lifecycle: create, open, save, streams, doc defaults, settings, properties, page setup, multi-section
Samples/StyleSystemSamples.cs
Styles: Normal/Heading chain, character/table/list styles, DocDefaults, latentStyles, CJK 公文, APA 7th, import, resolve inheritance
Samples/CharacterFormattingSamples.cs
RunProperties: fonts, size, bold/italic, all underlines, color, highlight, strike, sub/super, caps, spacing, shading, border, emphasis marks
Samples/ParagraphFormattingSamples.cs
ParagraphProperties: justification, indentation, line/paragraph spacing, keep/widow, outline level, borders, tabs, numbering, bidi, frame
Samples/TableSamples.cs
Tables: borders, grid, cell props, margins, row height, header repeat, merge (H+V), nested, floating, three-line 三线表, zebra striping
Samples/HeaderFooterSamples.cs
Headers/footers: page numbers, "Page X of Y", first/even/odd, logo image, table layout, 公文 "-X-", per-section
Samples/ImageSamples.cs
Images: inline, floating, text wrapping, border, alt text, in header/table, replace, SVG fallback, dimension calc
Samples/ListAndNumberingSamples.cs
Numbering: bullets, multi-level decimal, custom symbols, outline→headings, legal, Chinese 一/(一)/1./(1), restart/continue
Samples/FieldAndTocSamples.cs
Fields: TOC, SimpleField vs complex field, DATE/PAGE/REF/SEQ/MERGEFIELD/IF/STYLEREF, TOC styles
Samples/FootnoteAndCommentSamples.cs
Footnotes, endnotes, comments (4-file system), bookmarks, hyperlinks (internal + external)
Samples/TrackChangesSamples.cs
Revisions: insertions (w:t), deletions (w:delText!), formatting changes, accept/reject all, move tracking
Samples/AestheticRecipeSamples.cs
13 aesthetic recipes from authoritative sources: ModernCorporate, AcademicThesis, ExecutiveBrief, ChineseGovernment (GB/T 9704), MinimalModern, IEEE Conference, ACM sigconf, APA 7th, MLA 9th, Chicago/Turabian, Springer LNCS, Nature, HBR — each with exact values from official style guides
Note:
Samples/
path is relative to
scripts/dotnet/MiniMaxAIDocx.Core/
.
文件主题
Samples/DocumentCreationSamples.cs
文档生命周期:创建、打开、保存、流操作、文档默认设置、属性、页面布局、多章节
Samples/StyleSystemSamples.cs
样式系统:Normal/Heading样式链、字符/表格/列表样式、DocDefaults、latentStyles、CJK公文样式、APA第7版、样式导入、继承解析
Samples/CharacterFormattingSamples.cs
字符格式:字体、字号、粗体/斜体、所有下划线类型、颜色、高亮、删除线、下标/上标、大小写、字符间距、底纹、边框、着重号
Samples/ParagraphFormattingSamples.cs
段落格式:对齐方式、缩进、行/段落间距、孤行控制、大纲级别、边框、制表位、编号、双向文本、框架
Samples/TableSamples.cs
表格:边框、网格、单元格属性、边距、行高、表头重复、合并(水平+垂直)、嵌套表格、浮动表格、三线表、斑马纹
Samples/HeaderFooterSamples.cs
页眉/页脚:页码、“第X页,共Y页”、首页/偶数页/奇数页设置、Logo图片、表格布局、公文“-X-”格式、按章节设置
Samples/ImageSamples.cs
图片:嵌入式、浮动式、文字环绕、边框、替代文本、页眉/表格中插入、图片替换、SVG降级、尺寸计算
Samples/ListAndNumberingSamples.cs
编号列表:项目符号、多级十进制编号、自定义符号、大纲→标题、法律文书编号、中文一/(一)/1./(1)格式、编号重启/延续
Samples/FieldAndTocSamples.cs
域:目录、SimpleField与复杂域、DATE/PAGE/REF/SEQ/MERGEFIELD/IF/STYLEREF、目录样式
Samples/FootnoteAndCommentSamples.cs
脚注、尾注、批注(4文件系统)、书签、超链接(内部+外部)
Samples/TrackChangesSamples.cs
修订跟踪:插入(w:t)、删除(w:delText!)、格式修改、接受/拒绝所有修订、移动跟踪
Samples/AestheticRecipeSamples.cs
13种来自权威机构的排版方案:ModernCorporate、AcademicThesis、ExecutiveBrief、ChineseGovernment(GB/T 9704)、MinimalModern、IEEE Conference、ACM sigconf、APA 7th、MLA 9th、Chicago/Turabian、Springer LNCS、Nature、HBR——每种方案均包含官方样式指南中的精确参数值
注意:
Samples/
路径为相对路径,基于
scripts/dotnet/MiniMaxAIDocx.Core/
目录。

Markdown references (read when you need specifications or design rules)

Markdown参考资料(需要规范或设计规则时阅读)

FileWhen
references/openxml_element_order.md
XML element ordering rules (prevents corruption)
references/openxml_units.md
Unit conversion: DXA, EMU, half-points, eighth-points
references/openxml_encyclopedia_part1.md
Detailed C# encyclopedia: document creation, styles, character & paragraph formatting
references/openxml_encyclopedia_part2.md
Detailed C# encyclopedia: page setup, tables, headers/footers, sections, doc properties
references/openxml_encyclopedia_part3.md
Detailed C# encyclopedia: TOC, footnotes, fields, track changes, comments, images, math, numbering, protection
references/typography_guide.md
Font pairing, sizes, spacing, page layout, table design, color schemes
references/cjk_typography.md
CJK fonts, 字号 sizes, RunFonts mapping, GB/T 9704 公文 standard
references/cjk_university_template_guide.md
Chinese university thesis templates: numeric styleIds (1/2/3 vs Heading1), document zone structure (cover→abstract→TOC→body→references), font expectations, common mistakes
references/design_principles.md
Aesthetic foundations: 6 design principles (white space, contrast/scale, proximity, alignment, repetition, hierarchy) — teaches WHY, not just WHAT
references/design_good_bad_examples.md
Good vs Bad comparisons: 10 categories of typography mistakes with OpenXML values, ASCII mockups, and fixes
references/track_changes_guide.md
Revision marks deep dive
references/troubleshooting.md
Symptom-driven fixes: 13 common problems indexed by what you SEE (headings wrong, images missing, TOC broken, etc.) — search by symptom, find the fix
文件适用场景
references/openxml_element_order.md
XML元素顺序规则(避免文件损坏)
references/openxml_units.md
单位转换:DXA、EMU、半磅、八分之一磅
references/openxml_encyclopedia_part1.md
详细C#百科:文档创建、样式、字符与段落格式
references/openxml_encyclopedia_part2.md
详细C#百科:页面布局、表格、页眉/页脚、章节、文档属性
references/openxml_encyclopedia_part3.md
详细C#百科:目录、脚注、域、修订跟踪、批注、图片、公式、编号、文档保护
references/typography_guide.md
字体搭配、字号、间距、页面布局、表格设计、配色方案
references/cjk_typography.md
CJK字体、字号、RunFonts映射、GB/T 9704公文标准
references/cjk_university_template_guide.md
中文高校毕业论文模板:数字样式ID(1/2/3 vs Heading1)、文档区域结构(封面→摘要→目录→正文→参考文献)、字体要求、常见错误
references/design_principles.md
排版美学基础:6大设计原则(留白、对比/比例、 proximity、对齐、重复、层级)——解释“为什么”而非仅“怎么做”
references/design_good_bad_examples.md
正反案例对比:10类排版错误的OpenXML值、ASCII模拟图及修复方案
references/track_changes_guide.md
修订标记深度解析
references/troubleshooting.md
症状驱动的故障排除:13类常见问题(标题异常、图片丢失、目录失效等)——按症状搜索即可找到修复方案