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

本地生成专业办公文档

Office Generator Py · v1.0.0
办公 安全 B 级 作者 lujohn74 公开目录收录
1.2k 下载 0 安装 4.4k 收藏 17 浏览

简介

本地 Python 引擎生成 Word/Excel/PPT 文档,支持结构化 JSON 输入与商业模板,适合报告、会议纪要、项目计划等场景

原始描述

Generate Office files with a bundled Python engine. Use when creating or exporting Word (.docx), Excel (.xlsx), or PowerPoint (.pptx) files from structured J...

通过你的 Agent 添加

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

或者手动安装

Claude Code~/.claude/skills/office-generator-py/
Codex CLI~/.codex/skills/office-generator-py/
DeepSeek Harness~/.agents/skills/office-generator-py/

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

中文使用说明 来自收录源

核心用法

Office Generator Py 是一个基于本地 Python 引擎的办公文档生成工具,支持创建 Microsoft Word (.docx)、Excel (.xlsx) 和 PowerPoint (.pptx) 文件。该 skill 提供两种工作模式:标准模式(通过完整 JSON 请求文件指定文档类型、模板和内容规范)和商业模式(通过预设的 kind 参数快速生成常见业务文档,如工作报告、会议纪要、项目计划等)。

首次使用需运行 setup_engine.py 安装依赖,后续通过 generate_office.py 脚本执行生成任务。工具内置 6 种业务模板(3 类 Word、2 类 Excel、2 类 PPT),支持从结构化 JSON 或自然语言需求转换为 Office 文档。

显著优点

  • 本地化执行:不依赖云端 API,数据保留在本地环境
  • 多格式覆盖:一站式解决三大主流 Office 格式的生成需求
  • 模板化工作流:内置业务模板降低配置成本,提升常见文档产出效率
  • 灵活输入:支持原始 JSON 与简化命令行参数两种调用方式
  • 明确输出契约:成功时返回文件路径,失败时通过 stderr 输出错误信息

潜在缺点与局限性

  • 环境依赖:需预装 Python 3 及虚拟环境,首次配置存在技术门槛
  • 模板有限:目前仅 6 个内置模板,复杂或定制化需求需自行扩展
  • 无可视化编辑:纯命令行交互,不支持实时预览或 WYSIWYG 调整
  • 输入格式约束:自然语言需求需手动转换为结构化 JSON,增加了中间步骤

适合人群

  • 需要批量生成标准化业务文档的办公自动化用户
  • 希望将文档生成集成到本地工作流的技术人员
  • 对数据隐私敏感、倾向于本地处理而非云端方案的企业用户

常规风险

  • 路径安全:脚本接收绝对路径参数,需注意输入路径的合法性校验,避免路径遍历攻击
  • 依赖管理:Python 依赖包的供应链安全风险,建议锁定依赖版本并审计
  • 文件覆盖:输出路径若已存在文件将被覆盖,需确认目标路径安全性
  • 编码问题:要求 UTF-8 编码的 JSON 输入,编码错误可能导致生成失败
  • 沙箱缺失:文档生成过程在当前用户权限下执行,恶意模板或内容可能触发系统调用(若模板引擎支持脚本执行)

技能正文


name: office-generator-py description: Generate Office files with a bundled Python engine. Use when creating or exporting Word (.docx), Excel (.xlsx), or PowerPoint (.pptx) files from structured JSON, reports, meeting minutes, project plans, trackers, business briefs, or natural-language requirements that must be turned into Office documents.

Office Generator Py

Generate Office files with the bundled engine under scripts/engine/.

First run

Install Python dependencies into the bundled virtualenv:

python3 skills/office-generator-py/scripts/setup_engine.py

If you manage the environment yourself, you can point the wrapper at another Python binary with OFFICE_GENERATOR_PYTHON=/path/to/python.

Quick workflow

  1. Decide the output type: docx, xlsx, or pptx.
  2. Prefer a built-in business template when it fits.
  3. Write a UTF-8 JSON request file.
  4. Run scripts/generate_office.py.
  5. Return the produced file path.

Entrypoints

Use scripts/generate_office.py.

  • Standard mode: pass --type with a full JSON request file.
  • Business mode: pass --kind, --title, --input, and --out.

Built-in templates

Word

  • word_work_report_v1
  • meeting_minutes_v1

Excel

  • excel_data_tracker_v1
  • project_plan_v1

PPT

  • ppt_business_brief_v1
  • project_status_brief_v1

Built-in business kinds

  • word-report
  • meeting-minutes
  • excel-tracker
  • project-plan
  • ppt-brief
  • project-status-brief

Commands

Standard mode:

python3 skills/office-generator-py/scripts/generate_office.py \
  --type docx \
  --input /absolute/path/request.json \
  --out /absolute/path/output.docx

Business mode:

python3 skills/office-generator-py/scripts/generate_office.py \
  --kind meeting-minutes \
  --title "Office 评审会纪要" \
  --purpose "内部存档" \
  --input /absolute/path/content.json \
  --out /absolute/path/meeting_minutes.docx

Request shaping

If the user gives natural language only, convert it into JSON first.

For supported request formats and sample payloads, read references/input-formats.md.

Output contract

  • Success: stdout prints the generated file path.
  • Failure: stderr prints the error; command exits non-zero.

Notes

  • Keep output paths absolute when possible.
  • Prefer business mode for common document types.
  • Use standard mode when the caller already has full documentType/templateId/contentSpec JSON.

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

标签

document-generationofficepythonautomationdocxxlsxpptxreportingtemplate-engine

同类 Skill