微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📄

Word文档智能解析与图像优化专家

DOCX Toolkit · v1.0.0
办公 安全 A 级 作者 zacjiang 公开目录收录
1.1k 下载 0 安装 2.7k 收藏 86 浏览

简介

专业级Word文档解析工具,支持.docx与.doc双格式,高效提取文本、表格及图像,内置去重与压缩优化。

原始描述

Extract text, tables, and images from .docx and legacy .doc files. Handles large documents, CJK text, and complex table structures. Includes deduplication an...

通过你的 Agent 添加

安装目录:docx-toolkit/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/docx-toolkit/
Codex CLI~/.codex/skills/docx-toolkit/
DeepSeek Harness~/.agents/skills/docx-toolkit/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

DOCX Toolkit 是一款专注于 Microsoft Word 文档处理的本地工具集,支持现代 .docx 格式与 legacy .doc 双格式解析。核心功能模块包括:文本与表格提取(输出为结构化 pipe 分隔格式)、图片批量提取(自动 MD5 去重、大小过滤、序列重命名)、图片智能压缩(支持宽度限制批量处理,可节省 50-70% 视觉 API 调用成本)。所有操作均通过命令行脚本执行,输入输出路径完全由用户指定,适合集成至自动化文档处理流水线。

显著优点

格式兼容全面:同时覆盖现代 OpenXML 标准 (.docx) 与老旧 OLE2 格式 (.doc),解决企业遗留文档迁移痛点;CJK 深度优化:针对中日韩复杂文字编码提供完整支持,避免常见乱码问题;成本优化设计:图片压缩模块专为 AI 视觉 API 场景设计,大幅降低多模态调用费用;纯离线运行:零网络通信、零外部 API 依赖,敏感文档处理无需担心数据外传;透明可审计:Python 源码无混淆,依赖链仅 3 个成熟开源库(python-docx / olefile / Pillow)。

潜在局限

来源可信度限制:T3 级个人开发者维护,无企业背书,长期更新稳定性存疑;依赖版本浮动:未锁定依赖具体版本号,不同环境可能出现兼容性差异;大型文档性能瓶颈:超过 200MB 的 .doc 文件需消耗大量内存进行 OLE 解析;精准去重限制:图片去重仅基于 MD5 完全匹配,视觉相似但像素差异的图片仍会重复提取;路径安全待强化:当前脚本对用户输入路径直接处理,建议自行添加路径遍历防护。

适合人群

企业文档迁移工程师、需要批量处理历史 Word 档案的数据管理员、调用多模态 API 前需压缩文档图片的 AI 应用开发者、注重数据隐私的本地文档分析用户,以及构建文档自动化流水线的技术团队。

使用风险

内存与性能风险:超大文档处理可能导致内存溢出;依赖供应链风险:需自行跟踪 python-docx、olefile、Pillow 的安全更新;敏感数据暴露:提取输出的文本和图片文件可能包含机密信息,需严格管控输出目录权限;格式兼容性风险:极端复杂的 Word 排版(如嵌套文本框、自定义 XML)可能解析不完整。

技能正文


name: docx-toolkit description: Extract text, tables, and images from .docx and legacy .doc files. Handles large documents, CJK text, and complex table structures. Includes deduplication and filtering for extracted images. author: zacjiang version: 1.0.0 tags: docx, doc, word, extract, text, tables, images, document, office, CJK, chinese

DOCX Toolkit

A complete toolkit for processing Microsoft Word documents (.docx and legacy .doc formats).

Capabilities

1. Text + Table Extraction (.docx)

python3 {baseDir}/scripts/extract_text.py input.docx output.txt

Extracts all paragraphs and tables with structure preserved. Tables are formatted as pipe-delimited rows for easy parsing.

2. Text Extraction (Legacy .doc)

python3 {baseDir}/scripts/extract_doc_text.py input.doc output.txt

Handles legacy OLE2 .doc format using olefile. Extracts Unicode text from the WordDocument stream.

3. Image Extraction (.docx)

python3 {baseDir}/scripts/extract_images.py input.docx output_dir/

Extracts all embedded images with:

  • Automatic deduplication (MD5 hash comparison)
  • Size filtering (skips tiny icons <5KB by default)
  • Sequential renaming (img_001.png, img_002.jpg, etc.)

4. Image Compression

python3 {baseDir}/scripts/resize_images.py input_dir/ output_dir/ [--max-width 1024]

Batch resize/compress images for API processing (saves 50-70% on vision API costs).

Dependencies

  • Python 3.6+
  • python-docx — for .docx processing
  • olefile — for legacy .doc processing
  • Pillow — for image resizing (optional, only needed for resize script)

Install:

pip3 install python-docx olefile Pillow

Use Cases

  • Document analysis: Extract text for AI review/summarization
  • Migration: Pull content from Word docs into other formats
  • Image audit: Extract and review all embedded images
  • Cost optimization: Compress images before sending to vision APIs
  • Batch processing: Process multiple documents in a pipeline

Notes

  • Large .doc files (>200MB) may require significant RAM for olefile processing
  • Image extraction preserves original format (png/jpg/gif/etc.)
  • Deduplication catches exact duplicates; near-duplicates still pass through
  • CJK (Chinese/Japanese/Korean) text is fully supported in both extractors

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

documentdocxdoctext-extractionimage-processingofficebatch-processingCJKcompression

同类 Skill