office-docx SKILL.md skillA
office-docx from knowflow-ai/knowwork is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
mdr add knowflow-ai/knowwork/office-docx@git:20261021.536ea09Pins git:20261021.536ea09 in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 17 of 17 checks passed
- Kind
- SKILL.md skill
- Repository
- knowflow-ai/knowwork
- Path
runtime-host/plugins/dsh-host/skills/office-docx/SKILL.md- Versions recorded
- 1
- Latest version
- git:20261021.536ea09, committed Oct 21, 2026
- Size
- 8,739 bytes
- Repository stars
- 109
- License
- Apache-2.0
处理 Word 文档(.docx / .dotx)时使用。包括:用户提到 Word、docx、Word 文件、Word 模板,或要一份带目录、标题层级、页码、页眉信头等格式的正式文档;要从 .docx 里提取或重组内容;要在 Word 文件里插图、换图、查找替换;要以修订模式(带修订痕迹、可逐条接受拒绝)改稿或加批注;要把内容整理成一份像样的 Word 文件。用户要的报告、纪要、函件、模板、通知等交付物明确是 Word 或 .docx 时也用它。PDF、表格、腾讯文档/飞书文档,或与生成文档无关的编程任务不用。.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# DOCX:生成、修改与读取
`.docx` 是一个装着 XML 的压缩包。按任务选做法:
| 任务 | 做法 |
|---|---|
| **生成**新文档 | 写一个 `docx`(npm 包,即 docx-js)脚本——坑点见下 |
| **修改**已有文档 | 解压 → 改 `word/document.xml` → 打包(docx-js 打不开已有文件) |
| **读取**内容 | `pandoc -t markdown 文件.docx` |
> 下面的脚本都在 `/opt/knowwork/office/`。用户给的原文件在 `/workspace/input`(只读),
> 中间文件放 `/workspace/tmp`,要交给用户的放 `/workspace/output`,写好后调用 `present` 交付(例如 `present({"files":[{"path":"/workspace/output/报告.docx"}]})`)。知识库里的文档不是
> 这里的文件,改不了原件;用户要改它,请他把那份 .docx 作为附件上传。
## 用 docx-js 生成——坑点
`docx` 已经装好,直接 `require('docx')`,不要 `npm install`——沙箱没有网络,装不了。
API 你是知道的,要当心的是这些:
- **纸张默认 A4。** 要美式 Letter 就设 `page: { size: { width: 12240, height: 15840 } }`
(单位 DXA,1440 = 1 英寸)。国内文档用默认 A4 即可。
- **横向:** 传纵向的宽高,再加 `orientation: PageOrientation.LANDSCAPE`——docx-js 会自己对调宽高。
- **表格要两处宽度:** 表格上设 `columnWidths`,**每个**单元格上也设 `width`,都用
`WidthType.DXA`(PERCENTAGE 在部分软件里会错乱)。各列宽之和必须等于表格总宽。
- **单元格底色:** 用 `ShadingType.CLEAR`,不要用 `SOLID`(会渲染成全黑)。
- **列表:** 不要直接写 `•`;用 `numbering` 配置,`LevelFormat.BULLET`。
- **`ImageRun` 必须写 `type:`**(`"png"`、`"jpg"` 等)。
- **`PageBreak` 必须放在 `Paragraph` 里面。**
- **不要用 `\n` 换行**——每一段是一个单独的 `Paragraph`。
…Read the whole file at its exact version.
How to install
mdr add knowflow-ai/knowwork/office-docx@sha256:76a8bbf4d767bdacThe line at the top of this page pins the label git:20261021.536ea09, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_7n4ersulkt6ozyp7)
0 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 1 version of this file, committed on Oct 21, 2026.
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (8739 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
knowflow-ai/knowwork · 109 stars · license Apache-2.0 · pushed 2026-11-07 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_7n4ersulkt6ozyp7 GET https://markdownregistry.com/api/v1/resolve?ref=knowflow-ai/knowwork/office-docx GET https://markdownregistry.com/api/v1/blob/76a8bbf4d767bdac16d3f8c62311f1d6b60a1e8ebd0e259bcbad7d4dacf4c687
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.
More from knowflow-ai/knowwork
Every file in knowflow-ai/knowwork