write 生成
用结构化 JSON 创建新的 Office 文件。
基本用法
zagens-office write pptx --path out.pptx --input-file deck.json
zagens-office write docx --path out.docx --input-file doc.json
zagens-office write xlsx --path out.xlsx --input-file sheet.json --workspace .
zagens-office write pdf --path out.pdf --input-file doc.json
- 简单 payload 可用
--input '{...}';复杂 JSON 请用--input-file(避免 Windows shell 引号问题)。 - 可选
--preview stats|svg(docx/pptx)在结果里附带一步预览信息。
写前检查清单
schema write <format>确认字段- 定主题色板(写入
theme,全篇不引入色板外颜色) - 写完立刻
edit --op validate
PPT 提示(摘要)
- 相邻页换布局;全篇纯 bullets 页不超过一半
- 对比卡 / 图标行优先
elements[].type:"flow"(勿手算子坐标) - SmartArt:用默认样式,勿设
style/nodes[].image - 坐标
x_pct等首选 0.0–1.0;也接受 1–100 百分数 - 长 deck:先骨架
write,再用edit --op upsert_slide逐页替换/追加
完整契约以 schema write pptx 为准。