文牍
原名:docx
当用户需要创建、读取、编辑或操作 Word 文档(.docx)或模板(.dotx)时使用此技能。触发条件包括提及 Word 文档、.docx/.dotx 文件,或请求生成带有目录、标题、页码、信头等专业格式的文档。也用于从 .docx/.dotx 文件中提取或重组内容、插入或替换图片、执行查找替换、处理修订或批注,以及将内容转换为格式化的 Word 文档。如果用户要求以 Word 或 .docx 文件形式提供报告、备忘录、信函或模板,请使用此技能。不适用于 PDF、电子表格、Google Docs 或与文档生成无关的一般编程任务。
- 分类
- 内容创作
- 版本
- v1.0.0
- 作者
- 弈韬(@ra1nzzz)
- 下载
- 0
- 收藏
- 0
- 发布
- 2026-08-17
- 更新
- 2026-08-18
- TRACE 评分
- 3.4 / 5
内容概览
A .docx is a ZIP archive of XML files. Choose your approach by task: Task Approach --- --- Create a new document Write a docx (npm) script — see gotchas below Edit an existing document unzip → edit word/document.xml → zip (docx-js cannot open existing files) Read content pandoc -t markdown file.docx Script paths below are relative to this skill's directory. docx is preinstalled — do not run npm install first; write the script and require('docx') directly. Only if that require fails: npm install docx. The model knows the API; these are the footguns: - Page size defaults to A4. For US Letter set page: { size: { width: 12240, height: 15840 } } (DXA; 1440 = 1″). - Landscape: pass portrait dimensions and orientation: PageOrientation.LANDSCAPE — docx-js swaps width/height internally. - Tables need dual widths: set columnWidths on the table AND width on every cell, both in WidthType.DXA (PERCEN…