Loading...
Loading...
WPS Office CLI — JSON-driven automated PPT generation + command-line control of WPS Writer, Calc, and Impress
npx skill4agent add yb2460/harness-anything cli-anything-wpspip install pywin32pip install -e .
cli-anything-wps --help1. 提取模板背景: 模版.pptx → template_bg.png (960x540)
2. WebSearch 搜索数据: 招生分数线/学科排名/招生计划/科研数据
3. matplotlib 生成图表: 柱状图/饼图/折线图/横向柱/气泡图
4. 编写 data.json: 12-15页 elements[] 编排(标题≤4字 + 间距≥24pt)
5. python build_xxx.py: WPS COM 逐页构建
6. 输出: PPTX + PDF 双格式S1 封面 → S2 目录 → S3-S10 内容页(图+表+卡片) → S11 总结卡片 → S12 致谢| type | Purpose |
|---|---|
| Text box |
| Image (including matplotlib charts) |
| Table |
| 2-row × 3-column colored cards |
| 4-column numeric statistics cards |
| Numbered table-of-contents list |
| Bottom summary bar |
""Fill.ForeColor.RGBSaveAs(path, 32)taskkill //F //IM wps.exe //T| Project | Pages | Topic |
|---|---|---|
| Tsinghua Union/Lanzhou University/Tongji Medical College/Harbin Institute of Technology/Chongqing University/University of South China | 12 pages | University admissions |
| Sun Yat-sen University/University of Science and Technology of China/University of Chinese Academy of Sciences | 15 pages | Elite university admissions |
| Fudan University | 12 pages | New engineering + medical school |
| SUSTech Cancer Hospital | 12 pages | Joint master's and doctoral programs |
| Peking University/Tsinghua University/Southern University of Science and Technology/Huazhong University of Science and Technology/Zhejiang University City College | 9-14 pages | University profiles |
# 完整执行示例
python -c "import zipfile; ..." # 提取模板
python gen_charts.py # 生成图表
python -c "import json; json.load(open('data.json','r',encoding='utf-8'))" # 验证JSON
taskkill //F //IM wps.exe //T
python build_xxx.py # 构建PPTX+PDFwps
├── document # 文档管理: new/open/save/info
├── writer # 文字: add-paragraph/heading/list/table/image
├── calc # 表格: set-cell/get-cell/set-range/merge-cells
├── impress # 演示: add-slide/remove-slide/set-content/add-element
├── style # 样式: create/modify/list/apply/remove
├── preset # 设计预设: list/info/apply
├── export # 导出: render output.pptx -p pptx
└── session # 会话: status/undo/redo/history# 创建文档
cli-anything-wps document new --type writer --name "报告" -o report.json
cli-anything-wps --project report.json writer add-heading -t "年度报告" -l 1
cli-anything-wps --project report.json export render report.docx -p docx
# JSON模式(Agent使用)
cli-anything-wps --json document new --type writer --name "test"| Preset | Color Scheme | Use Case |
|---|---|---|
| academic | Dark Blue #1A3C8B | Academic defense/fund application |
| consultant | Dark Blue #003366 + Bright Cyan | Consulting report |
| business | Business Blue #005294 | Meeting report/courseware |
| tech | Near Black #0F1423 | Technology/AI/data report |
| Dimension | Check Items | Threshold |
|---|---|---|
| visual | Font hierarchy/contrast/whitespace | 70 points |
| pedagogy | Narrative arc/prerequisite knowledge | 75 points |
| proofreading | Spelling/terminology/overflow | 80 points |
| parity | PPTX/PDF consistency | 85 points |
| substance | Data accuracy/citations | 90 points |