SuperAPI AI Directory

cli-anything-wps

General & other

View repository

Updated 10-16 01:05

About this skill

cli-anything-wps

A command-line tool for controlling WPS Office via the COM automation interface. Supports WPS Writer, WPS Spreadsheets (Calc), and WPS Presentation (Impress).

Prerequisites

  • Windows operating system
  • WPS Office(installed, version 12.0+)
  • Python 3.10+
  • pywin32:pip install pywin32

Installation

pip install -e .
cli-anything-wps --help

JSON data-driven PPT auto-generation ⭐ Core production workflow

This is the most commonly used mode: gather data → generate matplotlib charts → write JSON → one-click generation via WPS COM.

Complete workflow (6 steps)

1. 提取模板背景: 模版.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 双格式

Standard page order

S1 封面 → S2 目录 → S3-S10 内容页(图+表+卡片) → S11 总结卡片 → S12 致谢

Element type routing

type Purpose
text Text box
image Image (including matplotlib charts)
table Table
cards_2x3 2-row x 3-column colored cards
cards_1x4_info 4-column numeric stat cards
card_list_wide Table of contents numbered list
tagline_bar Summary bar at the bottom of the page

Key constraints ⚠️

  • Spacing between title and content: title y=14 h=40 (ends at y≈54), the first content elementmuststart at y≥76-78 (≥24pt gap)
  • Title at most 4 characters, centered, SimHei 40-44pt, brand color,no decorative lines
  • JSON Chinese quotation marks: for quotes within text, use 「」 instead ""
  • All elements must not go off the canvas:960×540,y+h≤518
  • WPS COM:Fill.ForeColor.RGB,SaveAs(path, 32)Export PDF
  • Clean up before execution:taskkill //F //IM wps.exe //T

Reference cases

WPS/ 16 projects under the directory:

Project Pages Topic
Tsinghua Peking Union/Lanzhou University/Tongji Medical College/HIT/Chongqing University/Nanhua University 12 pages Each school's admissions
Sun Yat-sen University/USTC/UCAS 15 pages Elite school admissions
Fudan University 12 pages New engineering + medical school
SUSTech Cancer Hospital 12 pages Joint master's and doctoral training
Peking University/Tsinghua/SUSTech/HUST/Zhejiang University City College 9-14 pages Each school's introduction
# 完整执行示例
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+PDF

CLI command structure

wps
├── 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

Usage examples

# 创建文档
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"

Design presets

Preset Color scheme Applicable scenarios
academic Deep blue #1A3C8B Academic defense/funding applications
consultant Deep blue #003366 + bright cyan Consulting reports
business Business blue #005294 Conference presentations/courseware
tech Near-black #0F1423 Technology/AI/data reports

Quality review (5 dimensions)

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