Files
EapilSkillMarket/config/skill-overrides/docx/SKILL.md
T
KeyInfo Bot 36c089fee9 Sync third-party and MCP marketplace plugins
Constraint: Public skills are published only by explicit administrator action unless they are tracked third-party market sources.
Confidence: high
Scope-risk: narrow
Directive: Keep private/internal skills out of the public marketplace and preserve normal incremental market Git history.
Tested: Marketplace validation passed.
2026-10-06 15:29:22 +08:00

39 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: docx
description: 创建、读取、编辑和检查 Word 文档或模板(.docx/.dotx),包括中文排版、表格、批注和修订;适用于简体中文与 Windows PowerShell 环境。
license: Proprietary. LICENSE.txt has complete terms
---
# Word 文档
开始操作前读取 [references/platform.md](references/platform.md),确认 Python、Node、中文字体及需要的转换工具。命令中的脚本路径均相对本 Skill。
| 任务 | 选择 |
| --- | --- |
| 新建文档 | `docx`(Node)或 `python-docx`,按所需版式选择 |
| 提取正文或表格 | `python-docx`;需要查看修订时用 Pandoc 或检查 OOXML |
| 编辑复杂模板、批注或修订 | 保留 OOXML 结构,使用随附脚本 |
| .doc 旧文件 | LibreOffice 先转换为 .docx |
## 中文版式
未指定页面时,新文档采用 A4;已有文档沿用其页面和样式。正文中文字体设置 East Asian 字体,语言为 `zh-CN`,标题使用真正的标题样式。保持全角标点、编号、金额和原文引文;中文表格不要依赖空格对齐。
`docx` 创建时注意:表格同时指定列宽和单元格宽度;`ShadingType.CLEAR` 避免黑底;列表用 numbering 配置;`ImageRun` 指定类型;分页符放进 Paragraph。每个逻辑段落独立创建,不用换行模拟段落。需要 API 细节时按需读取 [upstream-guide.md](upstream-guide.md)。
## 编辑与审阅
先确认要清稿、批注还是保留修订;不要因文档类型自动强制红线。原有修订与批注保持不变,除非用户要求接受、拒绝或删除。
```powershell
python "$skill\scripts\office_package.py" unpack ".\输入.docx" ".\unpacked"
python "$skill\scripts\merge_runs.py" ".\unpacked"
# 按需编辑 word/document.xml,保持命名空间与节点顺序
python "$skill\scripts\office_package.py" pack ".\unpacked" ".\输出.docx"
python "$skill\scripts\office\validate.py" ".\输出.docx" --original ".\输入.docx"
```
`scripts/comment.py` 支持为文档添加批注;输出的定位节点需放到对应正文位置才能显示。`scripts/accept_changes.py` 仅在用户要求接受全部修订时使用,输出新文件;超时、文件未保存或仍有修订均算失败。
最终转换为 PDF,用 `scripts/render_pdf.py` 生成预览并查看中文字体、表格、页眉页脚、分页和页码。保留可编辑 Word 文件与用户需要的最终副本。