SuperAPI AI 工具集

docx

智能体与模型

查看项目

更新于 10-15 23:48

技能介绍

用途:创建、编辑和分析 .docx 文件。.docx 本质是包含 XML 与资源的 ZIP 包,可按任务选用不同工具与流程。

主要能力:文本提取与结构保留;原始 XML 访问(批注、复杂格式、文档结构、嵌入媒体、元数据);从零创建文档;编辑已有文档;面向法律、学术、商业、政府文档的跟踪修订(redlining);转换为图片以便视觉分析。

使用方式:读取内容可用 pandoc --track-changes=all path-to-file.docx -o output.md,可选 accept/reject/all。需要原始 XML 时先解包:python ooxml/scripts/unpack.py <office_file> <output_directory>;关键结构包括 word/document.xml、word/comments.xml、word/media/,修订用 <w:ins> 与 <w:del> 标签。创建新文档用 docx-js,须完整阅读 docx-js.md,以 Document、Paragraph、TextRun 构建并用 Packer.toBuffer() 导出。编辑已有文档用 Document 库,须完整阅读 ooxml.md,解包后用 Python 脚本修改,最后 python ooxml/scripts/pack.py <input_directory> <office_file> 打包。跟踪修订建议先转 markdown 定位,分批 3-10 处,遵循最小精确编辑原则,仅标记真正变化的文本并保留原 <w:r> 的 RSID,完成后重新打包并用 pandoc 校验。发布到 Google Docs 时改用 python-docx 并显式设置间距,示例:uv run --with python-docx python3 - <<'EOF' ... EOF,再执行 gspace drive_files_upsert local_path=/tmp/output.docx name="Document Title" parent_folder_id=FOLDER_ID convert_to_google_format=true。转图片:soffice --headless --convert-to pdf document.docx,然后 pdftoppm -jpeg -r 150 document.pdf page,可用 -f、-l 指定页范围。

适用场景:文档阅读与分析、新建 Word 文档、修订他人或正式文档、发布到 Google Drive、将 DOCX 转为图片分析。

依赖与限制:需要 pandoc(sudo apt-get install pandoc)、docx(npm install -g docx)、LibreOffice(sudo apt-get install libreoffice)、Poppler(sudo apt-get install poppler-utils)、defusedxml(pip install defusedxml)。参考资料未提供收费、价格、平台支持范围与实际效果等信息。跟踪修订须系统性实现所有变更,不使用 markdown 行号定位,Google Docs 的 References 中不要用本地 .md 文件链接。