尧图网络 高端网站定制 · 原创设计
免费咨询热线
400-888-6620
免费获取方案
办公文档处理_office-documents
以下为本文档的中文说明这是一个全面的办公文档处理技能支持 PDF、WordDOCX、ExcelXLSX/XLSM和 PowerPointPPTX四种常见办公文档格式的读取和编辑操作。它不依赖于 Microsoft Office 或 WPS 等商业软件而是通过开源 Python 库和直接 OOXML 解析来实现文档处理。核心工作流程严格遵循先读后改的原则首先通过 check_env.mjs 预检脚本检查环境是否满足特定操作所需的依赖然后使用 read_document.py 读取文档内容编辑时通过 JSON 操作文件指定要执行的操作序列最后重新读取输出文件验证变更是否正确。支持的编辑操作非常丰富DOCX 支持文本替换、追加段落和添加表格XLSX 支持单元格赋值、公式设置、追加行、添加/重命名工作表以及样式设置PPTX 支持文本替换、指定形状文本设置和文本框添加PDF 支持页面旋转、页面提取、页面删除、文件合并和元数据设置。使用场景包括自动化办公流程中的数据提取、批量生成报告、合同模板填充、数据分析结果导出等。该技能特别注重安全性——所有的编辑操作都保存到新文件而非覆盖原文件文档处理通过确定性脚本而非 AI 猜测操作确保了结果的可重复性和可靠性。Office DocumentsUse this skill for document files, not for building an Office viewer. The goal is to let the agent understand and safely modify files through deterministic scripts.Supported formats:PDF:.pdfWord:.docxExcel:.xlsx,.xlsmPowerPoint:.pptxDo not use Anthropic/Claude document skills as source material. This skill is independently written and relies on permissive open-source libraries or direct OOXML parsing. Seereferences/licenses.mdbefore changing dependencies.Core WorkflowIdentify the file type from the extension and the user’s requested outcome.Read first, edit second. Always inspect the source file before modifying it.Runscripts/check_env.mjsfor the exact capability before any Python worker script.For reading, runscripts/read_document.py.For edits, write a small JSON operations file and run the matching edit script.Save edits to a new output file unless the user explicitly asks to overwrite.Read the output file again withscripts/read_document.pyand verify the requested change.If the requested operation is outside the supported surface, say so clearly and stop.Environment PreflightRun the bundled Node preflight before invoking Python:nodeskills2set/office-documents/scripts/check_env.mjs--capabilityread-docxnodeskills2set/office-documents/scripts/check_env.mjs--capabilityread-pdfnodeskills2set/office-documents/scripts/check_env.mjs--capabilityedit-xlsxBehavior:The preflight itself is JavaScript and uses only Node built-ins.It finds Python throughHANA_OFFICE_PYTHON,python3,python, or Windowspy -3.It requires Python 3.10 because the bundled worker scripts use modern Python syntax.It checks only the packages needed for the requested capability.If it returnsok: false, stop and show the user themessageandinstallGuidance. Do not auto-install dependencies.Capabilities:TaskPreflight capabilityRead DOCXread-docxRead XLSX / XLSMread-xlsxRead PPTXread-pptxRead PDFread-pdfRequire MarkItDown specificallyenhanced-readDOCXreplace_textedit-docx-basicDOCXappend_paragraph/add_tableedit-docx-richXLSX / XLSM editsedit-xlsxPPTXreplace_textedit-pptx-basicPPTXset_shape_text/add_textboxedit-pptx-richPDF structural editsedit-pdfReadingUseread_document.pyfor every supported format:python3 skills2set/office-documents/scripts/read_document.py input.docx--formatmarkdown python3 skills2set/office-documents/scripts/read_document.py input.xlsx--formatjson--outputsummary.json python3 skills2set/office-documents/scripts/read_document.py input.pdf --max-chars120000Behavior:It tries MarkItDown first when available.If MarkItDown is unavailable, it uses direct OOXML readers for DOCX, XLSX, and PPTX.For PDF text extraction it tries pdfplumber, then pypdf.It returns clear JSON errors when required PDF libraries are unavailable or the file is unsupported.For large documents, read enough to understand structure first, then narrow by sheet, slide, page, heading, or searched text.EditingUse JSON operations. Keep each operation explicit and small enough to verify.DOCXpython3 skills2set/office-documents/scripts/edit_docx.py input.docx output.docx--opsops.jsonSupported operations:[{op:replace_text,find:old text,replace:new text},{op:append_paragraph,text:New paragraph},{op:add_table,rows:[[Name,Value],[A,10]]}]Usereplace_textfor safe text updates.append_paragraphandadd_tablerequirepython-docx.XLSXpython3 skills2set/office-documents/scripts/edit_xlsx.py input.xlsx output.xlsx--opsops.jsonSupported operations:[{op:set_cell,sheet:Sheet1,cell:B2,value:Approved},{op:set_formula,sheet:Sheet1,cell:C10, formula: SUM(C2:C9)},{op:append_row,sheet:Sheet1,values:[Total,1200]},{op:add_sheet,name:Summary},{op:rename_sheet,sheet:Sheet1,name:Data},{op:set_style,sheet:Data,cell:A1,bold:true,font_color:FFFFFF,fill_color:1F4E79}]XLSX editing requiresopenpyxl. Preserve formulas unless the user asks to replace them.PPTXpython3 skills2set/office-documents/scripts/edit_pptx.py input.pptx output.pptx--opsops.jsonSupported operations:[{op:replace_text,find:Q1,replace:Q2},{op:set_shape_text,slide:1,shape_index:2,text:Updated title},{op:add_textbox,slide:3,text:Speaker note,left:1,top:1,width:8,height:1}]Usereplace_textfor direct OOXML text updates. Shape targeting and text boxes requirepython-pptx.PDFpython3 skills2set/office-documents/scripts/edit_pdf.py input.pdf output.pdf--opsops.jsonSupported operations:[{op:rotate_pages,pages:1,3-4,degrees:90},{op:extract_pages,pages:1-2,5},{op:delete_pages,pages:7},{op:merge,inputs:[a.pdf,b.pdf]},{op:set_metadata,metadata:{/Title:Updated document}}]PDF editing requirespypdf. Do not claim support for arbitrary PDF text replacement. PDF text is drawing instructions, not normal document text.VerificationAfter any edit:Confirm the output file exists and is non-empty.Read the output withread_document.py.Check that requested content changed and unrelated content still appears intact.Report any limitation, dependency failure, or partial edit.For XLSX formulas, openpyxl preserves formulas but does not calculate them. If calculated values matter and no recalculation engine is available, say that formulas were written but not recalculated locally.Unsupported Or Caution CasesBe explicit when the requested task needs a real Office renderer or advanced document engine:Pixel-perfect layout repair.Scanned PDF OCR when no OCR engine or model is available.PDF arbitrary text replacement.Macros, VBA, encrypted files, password-protected files.Complex PowerPoint animations, transitions, SmartArt, embedded media, OLE objects.Excel pivot table authoring, slicers, external links, macros.Redline or track-changes fidelity matching Microsoft Word.If the user needs one of these, explain the specific limitation and suggest the smallest safe alternative.ReferencesRead only the relevant reference file when needed:references/docx.mdfor Word details.references/xlsx.mdfor spreadsheet details.references/pptx.mdfor PowerPoint details.references/pdf.mdfor PDF details.references/licenses.mdfor licensing and dependency constraints.
RELATED

相关推荐

后备命令处理_add-fallback-commands

后备命令处理_add-fallback-commands

以下为本文档的中文说明 该技能指导开发者如何为VS Code命令面板(Command Palette)扩展添加后备命令功能,实现全面搜索行为。当用户在命令面板中输入的查询无法匹配任何顶层命令时,后备命令会被触发,使扩展能充当全面处…

📅 2026/8/22 18:37:45
3分钟掌握SKkeeper:Blender形状键保护终极方案

3分钟掌握SKkeeper:Blender形状键保护终极方案

3分钟掌握SKkeeper:Blender形状键保护终极方案 【免费下载链接】SKkeeper Blender Addon to automate the process of applying modifiers to models with multiple shapekeys 项目地址: https://gitcode.com/gh_mirrors/sk/SKkeeper 你是否曾为Blender中应用…

📅 2026/8/22 18:37:45
【限时公开】国家人工智能标准化总体组内部文档节选:《AI Token参考架构V1.2》核心条款逐条解读(仅剩最后87份授权访问码)

【限时公开】国家人工智能标准化总体组内部文档节选:《AI Token参考架构V1.2》核心条款逐条解读(仅剩最后87份授权访问码)

更多请点击: https://intelliparadigm.com 第一章:AI Token是什么 AI Token 是一种专为人工智能应用生态设计的数字资产,既非传统加密货币,也不同于通用型代币,其核心价值锚定于AI模型调用权、算力配额、数据贡献证明…

📅 2026/9/10 22:27:52
MORE NEWS

更多资讯

📰

文档审查与人员访谈的双重验证技术解析

1. 项目背景与核心目标解析"27-1 Interview responsible personnel and examine documented"这一标题描述的是一个典型的文档审查与人员访谈相结合的工作流程。在各类审计、质量检查、合规性验证等场景中,这种双重验证机制被广泛采用。作为从业十余年的质…

📰

零基础学黑客技术:从Linux到渗透测试的完整自学路线与靠谱网站推荐

说个得罪人的大实话:号称“黑客技术自学网站”的东西,网上一搜一大把,但九成都是标题党。真正零基础入门到精通,靠的不是收藏一堆网址吃灰,而是把学习路径捋顺,知道每个阶段该上哪个网站、该动手练什么。我…

📰

黑客技术实战解析:从社会工程学到内网渗透的完整攻击链

干我们这行的,经常被外边问一句:"最强黑客技术你知道几个?"说实话,每次听到这种话我都挺犯难。大家想象里的黑客技术,可能是电影里敲几下键盘就让ATM吐钱、让电网瘫痪那种。但真正在安全圈里摸爬滚打过的人心…

📰

深度学习核心模型全解析:CNN、LSTM、Transformer与实战路线

作为一个常年混迹在AI圈、也带过不少新人入门的老兵,我经常被问到同一个问题:“我想学深度学习,但CNN、RNN、GAN、Transformer这些名词太吓人了,到底从哪下手?”说实话,网上讲深度学习的教程多如牛毛&#…

📰

gpt6实测:3D建模、电路原理图与Codex编码实战全记录

这个周末我基本是焊在电脑前面过的,从早到晚刷的都是同一件事:把现在热度最高的 gpt6 从文本、图片到代码轮着跑了一遍,重点做了三个项目的实测。说“狂蹬”一点都不夸张,连吃饭都在想下一个测试角度。一句话概括结果:…

📰

Zookeeper权限机制详解:从ACL认证到服务端校验的完整指南

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

TODAY

今日更新

THIS WEEK

本周精选

THIS MONTH

本月热门

读完文章,想聊聊您的网站?

告诉我们您的行业与需求,资深顾问一对一梳理方案与报价,全程免费。

📞 💬