Office Generator Py
Generate Office files with the bundled engine under scripts/engine/.
First run
Install Python dependencies into the bundled virtualenv:
CODEBLOCK0
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. - Prefer a built-in business template when it fits.
- Write a UTF-8 JSON request file.
- Run
scripts/generate_office.py. - 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
- - INLINECODE12
- INLINECODE13
Excel
- - INLINECODE14
- INLINECODE15
PPT
- - INLINECODE16
- INLINECODE17
Built-in business kinds
- - INLINECODE18
- INLINECODE19
- INLINECODE20
- INLINECODE21
- INLINECODE22
- INLINECODE23
Commands
Standard mode:
CODEBLOCK1
Business mode:
CODEBLOCK2
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.
Office Generator Py
使用 scripts/engine/ 下捆绑的引擎生成 Office 文件。
首次运行
将 Python 依赖安装到捆绑的虚拟环境中:
bash
python3 skills/office-generator-py/scripts/setup_engine.py
如果你自行管理环境,可以通过 OFFICEGENERATORPYTHON=/path/to/python 将包装器指向另一个 Python 二进制文件。
快速工作流程
- 1. 确定输出类型:docx、xlsx 或 pptx。
- 在适用时优先选用内置业务模板。
- 编写 UTF-8 编码的 JSON 请求文件。
- 运行 scripts/generate_office.py。
- 返回生成的文件路径。
入口点
使用 scripts/generate_office.py。
- - 标准模式:通过 --type 传入完整的 JSON 请求文件。
- 业务模式:通过 --kind、--title、--input 和 --out 传入参数。
内置模板
Word
- - wordworkreportv1
- meetingminutes_v1
Excel
- - exceldatatrackerv1
- projectplan_v1
PPT
- - pptbusinessbriefv1
- projectstatusbriefv1
内置业务类型
- - word-report
- meeting-minutes
- excel-tracker
- project-plan
- ppt-brief
- project-status-brief
命令
标准模式:
bash
python3 skills/office-generator-py/scripts/generate_office.py \
--type docx \
--input /absolute/path/request.json \
--out /absolute/path/output.docx
业务模式:
bash
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
请求格式化
如果用户仅提供自然语言,请先将其转换为 JSON。
有关支持的请求格式和示例负载,请阅读 references/input-formats.md。
输出约定
- - 成功:标准输出打印生成的文件路径。
- 失败:标准错误输出打印错误信息;命令以非零状态退出。
注意事项
- - 尽可能使用绝对路径作为输出路径。
- 对于常见文档类型,优先使用业务模式。
- 当调用方已拥有完整的 documentType/templateId/contentSpec JSON 时,使用标准模式。