跳到正文
Skillpedia
PDF、Word 与幻灯片14k · #11293

minimax-docx

它能做什么

这项技能使用 OpenXML 工具创建和编辑 Word 文档。适合需要专业文档的人,例如报告、提案或格式化的模板。

适用场景

  • ✓当你要求以 Word 文件形式撰写报告、提案或信函的时候。
  • ✓当你想在现有 Word 文档中填写或修改内容的时候。
  • ✓当你想把模板的格式应用到文档上的时候。

技能链接

https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-docx/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-docx/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我写一份关于季度业绩的 Word 报告,包含标题、表格和整洁的版式。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会先设置工具,然后通过命令行工具或自定义的 C# 脚本编写或编辑文档。完成前,它会根据 Word 格式规则检查文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

minimax-docx

Create, edit, and format DOCX documents via CLI tools or direct C# scripts built on OpenXML SDK (.NET).

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.)

Quick Start: Direct C# Path

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:

// 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.

CLI shorthand

All CLI commands below use $CLI as shorthand for:

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).

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

Scenario A: Create

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).

Scenario B: Edit / Fill

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
$CLI edit replace-text --in
常见问题

它需要特殊的软件吗?

这项技能包含工具的设置步骤,其中 OpenXML 脚本需要 .NET。

它能编辑我已有的文档吗?

能。它有一套用于填充和编辑现有 Word 文件内容的流程。

它如何确保文件有效?

在报告成功之前,它会对 Word 文件格式规则运行验证步骤。

详情

作者的原始描述

Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET). Three pipelines: (A) create new documents from scratch, (B) fill/edit content in existing documents, (C) apply template formatting with XSD validation gate-check. MUST use this skill whenever the user wants to produce, modify, or format a Word document — including when they say "write a report", "draft a proposal", "make a contract", "fill in this form", "reformat to match this template", or any task whose final output is a .docx file. Even if the user doesn't mention "docx" explicitly, if the task implies a

repo: MiniMax-AI/skills

热度

GitHub 星标
14k
排名
#11293
许可证
MIT
更新时间
2026/4/18

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能