← 返回 Skills 市场
mo-yuhua

Doc Processor

作者 fuyabing6803 · GitHub ↗ · v2.7.13 · MIT-0
cross-platform ✓ 安全检测通过
399
总下载
0
收藏
3
当前安装
20
版本数
在 OpenClaw 中安装
/install doc-processor
功能描述
智能文档生成引擎 - 样式感知 + 三层模板 + 动态分类 支持 Word/Excel/PDF/CSV/TXT 读取、写入、转换、合并、提取、模板填充 v2.7: 性能监控 + 用户文档 + 错误增强 v2.6: Excel 格式保持 + PDF 生成 v2.5: 批量处理 + 模板缓存 v2.4: 日志系统 +...
使用说明 (SKILL.md)

文档处理 Skill (Doc Processor)

统一的本地文档处理工具,支持多种格式的读取、写入、转换、合并和数据提取。

支持格式

格式 扩展名 读取 写入 转换 合并 提取
PDF .pdf ⚠️
Word .docx
Excel .xlsx
CSV .csv -
文本 .txt -
Markdown .md -

注意:

  • ❌ 不支持 .doc.xls 旧格式(需先用 LibreOffice 转换)
  • ✅ PDF 处理使用系统工具 poppler-utils

v2.7.11 重要变更

AI 功能已移除

v2.7.11 起,AI 功能(AI 摘要、AI 分析)已移除,原因:

  1. 职责单一: doc-processor 专注文档处理
  2. 架构优化: AI 能力由 OpenClaw 主程序统一提供
  3. 简化配置: 无需单独配置 LLM_BASE_URL 等环境变量
  4. 提升安全: 移除网络请求,消除 ClawHub 安全标记

如需 AI 功能,请使用 OpenClaw 主程序的 LLM 能力:

# 1. 使用 doc-processor 读取文档
content = doc_processor.read('report.docx')

# 2. 将内容发送给 OpenClaw 的 LLM 进行摘要/分析
# (通过 OpenClaw 的消息系统或 API)

受影响的 API

以下方法已移除或修改:

方法 原功能 新行为
ContentAdapter.__init__(ai_service_type) AI 服务配置 参数已移除
DocumentProcessor.__init__(ai_service_type) AI 服务配置 参数已移除
create_ai_service() 创建 AI 服务 抛出 NotImplementedError
summarize_document() AI 摘要 抛出 NotImplementedError

迁移指南

原代码 (v2.7.10):

processor = DocumentProcessor(ai_service_type='hybrid')
summary = processor.summarize_document('file.docx')

新代码 (v2.7.11):

# 1. 读取文档
processor = DocumentProcessor()
content = processor.read('file.docx')

# 2. 使用 OpenClaw 主程序进行 AI 处理
# (具体方式取决于 OpenClaw 的实现)

安装

一键安装

cd ~/.openclaw/workspace/skills/doc-processor
./setup.sh

安装脚本说明:

  • ✅ 标准 pip 操作,安装 Python 依赖
  • ✅ 依赖列表:python-docx, openpyxl, pandas, python-dotenv
  • ✅ 从官方 PyPI 或可信镜像源安装
  • ✅ 无恶意代码,完全开源

详情见:SECURITY.md

手动安装

1. 安装系统依赖

# Linux (Debian/Ubuntu)
sudo apt install poppler-utils

# Linux (RHEL/CentOS)
sudo yum install poppler-utils

# macOS
brew install poppler

2. 安装 Python 依赖

# 使用默认官方源
./setup.sh

# 使用清华镜像源(中国大陆推荐)
./setup.sh https://pypi.tuna.tsinghua.edu.cn/simple

# 或使用环境变量
export PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
./setup.sh

# 其他镜像源
./setup.sh https://pypi.mirrors.ustc.edu.cn/simple

3. 验证安装

python3 check_deps.py

使用示例

获取文档信息

./scripts/doc-info.sh report.pdf

读取文档

# 读取 PDF
./scripts/doc-read.sh report.pdf

# 读取 Word(包含表格)
./scripts/doc-read.sh meeting.docx

# 读取 Excel(所有 sheet)
./scripts/doc-read.sh data.xlsx

写入文档

# 写入 Word
echo '{"title": "报告", "paragraphs": ["第一段", "第二段"]}' | \
  ./scripts/doc-write.sh -o output.docx

# 写入 Excel
echo '[["姓名", "年龄"], ["张三", 25], ["李四", 30]]' | \
  ./scripts/doc-write.sh -o data.xlsx

格式转换

# Word 转 CSV
./scripts/doc-convert.sh table.docx table.csv

# Excel 转 Word
./scripts/doc-convert.sh data.xlsx report.docx

# PDF 转文本
./scripts/doc-convert.sh report.pdf report.txt

合并文档

# 合并 Word 文档
./scripts/doc-merge.sh part1.docx part2.docx -o merged.docx

# 合并 Excel(每个文件→独立 sheet)
./scripts/doc-merge.sh q1.xlsx q2.xlsx -o yearly.xlsx

提取数据

# 提取 Word 中的表格
python3 doc_processor.py --action extract \
  --input report.docx --options '{"include_tables": true}'

# 提取 Excel 指定 sheet
python3 doc_processor.py --action extract \
  --input data.xlsx --options '{"sheet_names": ["Sheet1"]}'

Python API

from doc_processor import DocumentProcessor

processor = DocumentProcessor(workspace="/path/to/workspace")

# 获取文档信息
info = processor.get_info("report.docx")
print(info.to_dict())

# 读取内容
content = processor.read("report.docx")
print(content.data['paragraphs'])

# 写入文档
processor.write("output.docx", {
    "title": "新文档",
    "paragraphs": ["内容 1", "内容 2"]
})

# 转换格式
processor.convert("input.docx", "output.csv")

# 合并文档
processor.merge(["a.docx", "b.docx"], "merged.docx")

# 提取数据
data = processor.extract("data.xlsx")

依赖说明

依赖 类型 用途 自动安装
poppler-utils 系统 PDF 读取 ✅ (Linux/macOS)
python3 系统 运行环境 ❌ (需预装)
python-docx Python Word 处理 ✅ (setup.sh)
openpyxl Python Excel 读写 ✅ (setup.sh)
pandas Python 数据处理 ✅ (setup.sh)

更新日志

v1.0.4 (2026-03-25)

Bug 修复:

  • ✅ 修复 Excel 写入失败问题 - 支持 {'sheet_name': '...', 'data': [...]} 格式
  • ✅ 修复 Word 合并失败问题 - 正确处理相对路径,避免 "Package not found" 错误

v1.0.3 (2026-03-25)

Bug 修复:

  • ✅ 修复 CSV→Excel 转换问题
  • ✅ 修复 DocInfo 属性问题

常见问题

Q: 为什么不支持 .doc 和 .xls?

A: 这些是旧的二进制格式,需要 LibreOffice 转换。建议先用 LibreOffice 转换为 .docx/.xlsx

libreoffice --headless --convert-to docx old.doc
libreoffice --headless --convert-to xlsx old.xls

Q: PDF 写入支持吗?

A: 不支持。PDF 是只读格式。如需生成 PDF,可先创建 Word 文档再手动转换。

Q: 大文件处理慢怎么办?

A: 建议使用 --options 限制读取范围:

# 只读取 PDF 前 5 页
python3 doc_processor.py --action read \
  --input large.pdf --options '{"pages": "1-5"}'

许可证

MIT License

安全使用建议
This package appears to be a locally focused document-processing tool and is internally coherent with its description. Before installing: (1) open and inspect setup.sh (it will run pip and any commands on your machine); (2) run check_deps.py to verify expected system tools (pdftotext/pdfinfo) and Python modules; (3) install inside a virtualenv to limit scope; (4) verify the logging env vars (DOC_PROCESSOR_LOG_FILE) won't write logs to sensitive locations; (5) if you want to be extra cautious, review any omitted files (setup.sh and remaining code not shown in the truncated dump) to confirm there are no unexpected network calls or shell invocations. If you need the old AI features, note they were removed in v2.7.11 and are expected to be provided by the OpenClaw host instead.
功能分析
Type: OpenClaw Skill Name: doc-processor Version: 2.7.13 The doc-processor skill bundle is a comprehensive and well-documented tool for handling various document formats (Word, Excel, PDF, etc.). The code follows standard practices for document manipulation using established libraries like pandas and python-docx, and it explicitly removed network-dependent AI features in version 2.7.11 to improve security and reduce the attack surface. No evidence of data exfiltration, malicious execution, or unauthorized persistence was found across the Python logic (doc_processor.py) or the installation scripts (setup.sh).
能力评估
Purpose & Capability
The name/description (Word/Excel/PDF processing, template filling, batch processing) matches the files and APIs present (doc_processor.py, excel_style.py, pdf_generator, scripts). The declared system binaries (pdftotext, pdfinfo) are appropriate for PDF reading. Required Python dependencies (python-docx, openpyxl, pandas) align with the stated features.
Instruction Scope
SKILL.md instructs only local operations (reading/writing/converting/merging files) and to run setup.sh / scripts under the skill workspace. The codebase refers to a workspace path (~/.openclaw/workspace/ and user-templates) and to optional environment variables for logging (DOC_PROCESSOR_LOG_LEVEL, DOC_PROCESSOR_LOG_FILE) that are not listed as required in the manifest — this is benign but worth noting. No obvious instructions to read unrelated system files or to transmit data externally appear in the provided snippets; earlier AI/networking modules were explicitly removed in recent versions.
Install Mechanism
There is no remote one-step binary download in the manifest; installation is via a local setup.sh that runs pip install -r requirements.txt and the metadata suggests using system package managers for poppler. pip installs from PyPI (or user-specified mirrors) are the only network activity implied. This is standard for Python projects but carries the usual supply-chain risk; the install script should be inspected before running.
Credentials
The skill declares no required credentials or config paths. It does use/observe optional env vars for logging (DOC_PROCESSOR_LOG_LEVEL, DOC_PROCESSOR_LOG_FILE) and the SKILL.md shows examples of providing a PIP_INDEX_URL when running setup.sh. These environment usages are reasonable for configuration; they are not secret credentials and do not appear to be used for exfiltration. Still, DOC_PROCESSOR_LOG_FILE allows writing logs to a path under user control — verify that the path is safe.
Persistence & Privilege
The skill is not flagged always:true and is user-invocable only. It stores user templates within the skill's workspace (~/.openclaw/workspace/user-templates/) which is consistent with its purpose. There is no indication it modifies other skills or global agent configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install doc-processor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /doc-processor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.7.13
🧹 清理 AI 残留代码 (ices 测试反馈) - 删除 create_ai_service 等残留 - 统一版本号 - 补充发布说明
v2.7.12
v2.7.12: 安全优化 (完善文档 + 安装脚本说明)
v2.7.11
v2.7.11: 移除 AI 功能 (架构重构,由 OpenClaw 主程序统一处理)
v2.7.10
vpatch 更新
v2.7.5
v2.7.5 focuses on bugfixes and exception handling improvements. - Fixed path parsing bugs during document operations. - Improved and unified error/exception handling for more robust processing. - Documentation updated to reflect recent bugfixes and enhancements. - Added release notes file for this version.
v2.7.4
v2.7.4: 集成 8 个新模块(性能监控/批量处理/缓存管理/错误处理/AI 服务/日志系统/Excel 样式/PDF 生成),新增 Word/Excel→TXT 转换,修复 TemplateCache 布尔值判断错误。测试覆盖:22 个测试用例 100% 通过率。
v2.7.3
v2.7.3: 修复 metadata 声明 - 移除 python3 系统依赖声明
v2.7.2
v2.7.2: 修复安全扫描警告 - 移除硬编码 pip 镜像源 + 更新元数据匹配
v2.7.1
v2.7.1: 修复安全扫描警告 - 移除硬编码 pip 镜像源
v2.7.0
v2.7.0: 性能监控 + 用户文档 + 错误信息增强
v2.3.0
v2.3: Excel 模板支持 - 新增单元格占位符填充、命名单元格填充、表格区域自动填充(多行数据)。支持 Word+Excel 双模板,Excel 用户覆盖率从 0% → 100%。
v2.2.0
v2.2: 模板匹配智能化 - 新增 AI 请求分析(文档类型/使用场景/样式偏好)、多维度评分模型(5 维度加权)、场景相似度计算、样式相似度计算、最近使用分数、匹配解释生成。匹配准确率从 60% → 90%。
v2.1.0
v2.1: AI 深度集成 - 新增智能摘要(句子分割)、列表自动扩展、计划时间估算、样式提取增强(段落间距/行距/缩进/颜色)。向后兼容 v2.0.x。
v2.0.0
v2.0: 智能文档生成引擎 - 新增样式感知、内容适配、三层模板策略、用户模板管理、Style Guide 引导
v1.0.5
修复 CSV→Excel 转换 bug:1) _write_excel 新增 has_header 参数,正确处理表头;2) convert 方法调用时传递 has_header=true,确保 CSV 列名正确导入;3) 全面测试通过(10/10 项)
v1.0.4
修复 Excel 写入和 Word 合并 Bug
v1.0.3
紧急修复 v1.0.2 遗留问题:1) Excel 写入 - 修复二维列表转 DataFrame 错误;2) CSV→Excel 转换 - 修复数据结构解析,正确重建二维列表;3) DocInfo - 新增 filename 字段(API 兼容);4) Word 合并 - 验证通过无异常
v1.0.2
Bug 修复:1) Excel 空数据写入失败 - 修复空列表/空字典处理;2) Word 转 CSV 失败 - 修复数据结构提取;3) CSV 读取列解析问题 - 新增中文逗号等分隔符自动检测;4) 延迟导入优化避免依赖缺失报错
v1.0.1
改进虚拟环境管理(统一到~/.openclaw/workspace/.venvs/),新增 references/ 和 templates/ 文档目录
v1.0.0
Initial release: unified local document processor for Word, Excel, PDF, CSV, TXT, and Markdown. - Supports reading, writing, conversion, merging, and data extraction for multiple document formats. - Provides both command line scripts and Python API for streamlined document operations. - Utilizes poppler-utils for PDF processing (read-only). - Includes automated setup scripts for required system and Python dependencies. - Highlights limitations for legacy formats (.doc, .xls) and clarifies PDF write restrictions.
元数据
Slug doc-processor
版本 2.7.13
许可证 MIT-0
累计安装 3
当前安装数 3
历史版本数 20
常见问题

Doc Processor 是什么?

智能文档生成引擎 - 样式感知 + 三层模板 + 动态分类 支持 Word/Excel/PDF/CSV/TXT 读取、写入、转换、合并、提取、模板填充 v2.7: 性能监控 + 用户文档 + 错误增强 v2.6: Excel 格式保持 + PDF 生成 v2.5: 批量处理 + 模板缓存 v2.4: 日志系统 +... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 399 次。

如何安装 Doc Processor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install doc-processor」即可一键安装,无需额外配置。

Doc Processor 是免费的吗?

是的,Doc Processor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Doc Processor 支持哪些平台?

Doc Processor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Doc Processor?

由 fuyabing6803(@mo-yuhua)开发并维护,当前版本 v2.7.13。

💬 留言讨论