claude_code_public_skills / ms_office_x_editer
CLAUDE.md9 starsChanged 4 months agoMITView on GitHub
通过 JSZip 操作 Office 文件(ZIP 格式),直接处理 XML 字符串。入口 run.js 根据文件扩展名分流到 docx/xlsx 处理逻辑。
- Installs packages
In this repository64 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- cmo-weather-query/CLAUDE.mdCLAUDE.md
- db_client/CLAUDE.mdCLAUDE.md
- deepseek-search/CLAUDE.mdCLAUDE.md
- documents_ripgrep/CLAUDE.mdCLAUDE.md
- excel-alasql/CLAUDE.mdCLAUDE.md
- game_mahjong_agent/CLAUDE.mdCLAUDE.md
- gaode_map/CLAUDE.mdCLAUDE.md
- magpie-image-gen/CLAUDE.mdCLAUDE.md
- ssh2-node/CLAUDE.mdCLAUDE.md
- use_http_mcp/CLAUDE.mdCLAUDE.md
- where-am-i/CLAUDE.mdCLAUDE.md
- 88chaSkill
- agent-browserSkill
- baidu-search-nodejsSkill
- brz-repair-manual-querySkill
- cmo-weather-querySkill
- db-clientSkill
- deepseek-searchSkill
- dianping-searchSkill
- doc-readerSkill
- documents-ripgrepSkill
- drawio-nodejsSkill
- excel-alasqlSkill
- figma-code-connectSkill
- figma-create-design-system-rulesSkill
- figma-create-new-fileSkill
- figma-generate-designSkill
- figma-generate-librarySkill
- figma-implement-designSkill
- figma-useSkill
- file-code-boxSkill
- financialSkill
- game-mahjong-agentSkill
- gaode-mapSkill
- gitea-apiSkill
- happy-agent-easySkill
- hindsightSkill
- jina-readerSkill
- kavita-liteSkill
- magpie-image-genSkill
- magpie-toolsSkill
- makepad-evolutionSkill
- markitdown-pdfSkill
- memos-nodeSkill
- mind-map-skillSkill
- ms-office-x-editerSkill
- nexus3-skillSkill
- obsidian-basesSkill
- obsidian-cliSkill
- json-canvasSkill
- ocr-toolSkill
- opencode-go-usageSkill
- sendmailSkill
- siyuan-apiSkill
- smb-clientSkill
- ssh2-nodeSkill
- use-http-mcpSkill
- website-security-scanSkill
- where-am-iSkill
- The first 60 shown.
The file
Files
CLAUDE.md — ms_office_x_editer
架构
通过 JSZip 操作 Office 文件(ZIP 格式),直接处理 XML 字符串。入口 run.js 根据文件扩展名分流到 docx/xlsx 处理逻辑。
核心模块
docx 模块
| 模块 | 职责 |
| DocxZip | ZIP 加载/保存/文件读写(docx/xlsx 共用) |
| cli.js | docx 命令分发与实现 |
| XmlTextOps | 段落文本提取、跨 run 搜索/替换 |
| XmlTableOps | 表格列表、读取、单元格修改 |
| ImageOps | 图片列表、导出、替换 |
| HeaderFooterOps | 页眉页脚读取/替换 |
| MetaOps | 元数据读取/修改(docx/xlsx 共用) |
| StyleOps | docx 文本样式修改 |
| DiffOps | 文档差异算法(LCS 对齐、词级 diff) |
| DiffMd | 差异报告 Markdown 格式化 |
xlsx 模块
| 模块 | 职责 |
| xlsx_cli.js | xlsx 命令分发与实现 |
| xlsx_utils.js | 坐标转换、sharedStrings 解析/构建、XML 属性操作 |
| sheet_ops.js | 工作表操作(列表、读写、重命名) |
| xlsx_style_ops.js | xlsx 样式读取/应用 |
xlsx 关键设计
sharedStrings 机制
xlsx 文本单元格 t="s" 的 <v> 存的是 sharedStrings 索引:
- 读:解析
<si><t>文本</t></si>建索引→文本映射 - 写:新文本追加到 sharedStrings,更新
count/uniqueCount - 文件可能不存在(空工作簿),首次写入时创建
单元格坐标转换
A1 → {col:0, row:0},列字母支持多字母(AA=26, AB=27...)
集中式样式系统
<c s="0"> 的 s 引用 cellXfs[0],<xf fontId fillId borderId> 组合子样式。
修改样式:找或创建匹配的 <xf>,更新单元格的 s 属性。
关键算法
跨 Run 文本替换
docx 中的文本可能被拆分到多个 <w:r> 元素。策略:
- 在每个
<w:p>内拼接所有<w:t>得到完整文本 - 在完整文本上搜索匹配位置
- 从后往前替换,保持第一个 run 的格式属性
括号平衡 XML 提取
用 indexOf + 深度计数提取 XML 块,替代不可靠的正则匹配嵌套标签。
开发命令
cd ms_office_x_editer
pnpm install
npm run build
# docx
node skill.js demo/SHFY-WPS-SS-9086-1.docx info
# xlsx
node skill.js demo/工作簿1.xlsx xlsx-infoDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

