Communitygithub.com

yb2460/cli-anything-wps

WPS Office CLI — JSON数据驱动PPT自动生成 + 命令行操控WPS文字/表格/演示文稿

cli-anything-wps 是什么?

cli-anything-wps is a Claude Code agent skill that wPS Office CLI — JSON数据驱动PPT自动生成 + 命令行操控WPS文字/表格/演示文稿.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yb2460/harness-anything/tree/master/cli_anything/wps/skills

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

cli-anything-wps 是做什么的?

A command-line tool to control WPS Office via the COM automation interface. Supports WPS Writer, WPS Calc, and WPS Impress.

Prerequisites

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

Installation

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

JSON-Driven PPT Auto-Generation ⭐ Production Core Workflow

This is the most commonly used mode: Search data → Generate matplotlib charts → Write JSON → One-click WPS COM generation.

Complete Workflow (6 Steps)

1. Extract template background: template.pptx → template_bg.png (960x540)
2. WebSearch data: Admissions scores / Subject rankings / Enrollment plans / Research data
3. matplotlib generate charts: Bar chart / Pie chart / Line chart / Horizontal bar / Bubble chart
4. Write data.json: 12-15 pages elements[] arrangement (title ≤ 4 chars + spacing ≥ 24pt)
5. python build_xxx.py: WPS COM builds slide by slide
6. Output: PPTX + PDF dual format

Standard Slide Order

S1 Cover → S2 Table of Contents → S3-S10 Content pages (charts + tables + cards) → S11 Summary card → S12 Acknowledgments

Element Type Routing

typePurpose
textText box
imageImage (including matplotlib charts)
tableTable
cards_2x32-row x 3-column colored cards
cards_1x4_info4-column numerical stats cards
card_list_wideTable of contents numbered list
tagline_barPage bottom summary bar

Key Constraints ⚠️

  • Title to content spacing: Title y=14 h=40 (ends at y≈54), first content element must start at y≥76-78 (≥24pt gap)
  • Title max 4 characters, centered, SimHei 40-44pt, brand color, no decorative lines
  • JSON Chinese-style quotes: Use 「」 instead of "" for text citations
  • All elements stay within canvas: 960×540, y+h≤518
  • WPS COM: Fill.ForeColor.RGB, SaveAs(path, 32) to export PDF
  • Clean up before execution: taskkill //F //IM wps.exe //T

Reference Examples

16 projects under the WPS/ directory:

ProjectPagesTopic
Tsinghua PUMC/Lanzhou University/Tongji Medical College/Harbin Institute of Technology/Chongqing University/Nanhua University12 pagesUniversity admissions
Sun Yat-sen University/USTC/UCAS15 pagesPrestigious university admissions
Fudan University12 pagesNew engineering + Medical school
SUSTech Cancer Hospital12 pagesJoint Master/PhD program
Peking University/Tsinghua/SUSTech/HUST/Zhejiang University City College9-14 pagesUniversity introductions
# Full execution example
python -c "import zipfile; ..."  # Extract template
python gen_charts.py              # Generate charts
python -c "import json; json.load(open('data.json','r',encoding='utf-8'))"  # Validate JSON
taskkill //F //IM wps.exe //T
python build_xxx.py               # Build PPTX+PDF

CLI Command Structure

wps
├── document          # Document management: new/open/save/info
├── writer            # Writer: add-paragraph/heading/list/table/image
├── calc              # Calc: set-cell/get-cell/set-range/merge-cells
├── impress           # Impress: add-slide/remove-slide/set-content/add-element
├── style             # Styles: create/modify/list/apply/remove
├── preset            # Design presets: list/info/apply
├── export            # Export: render output.pptx -p pptx
└── session           # Session: status/undo/redo/history

Usage Examples

# Create a document
cli-anything-wps document new --type writer --name "Report" -o report.json
cli-anything-wps --project report.json writer add-heading -t "Annual Report" -l 1
cli-anything-wps --project report.json export render report.docx -p docx

# JSON mode (for Agent use)
cli-anything-wps --json document new --type writer --name "test"

Design Presets

PresetColor SchemeUse Case
academicDeep blue #1A3C8BAcademic defense / Grant applications
consultantDeep blue #003366 + Bright cyanConsulting reports
businessBusiness blue #005294Meeting reports / Courseware
techNear black #0F1423Tech / AI / Data reports

Quality Review (5 Dimensions)

DimensionCheck ItemsThreshold
visualFont hierarchy / Contrast / Whitespace70 points
pedagogyNarrative arc / Prerequisite knowledge75 points
proofreadingSpelling / Terminology / Overflow80 points
parityPPTX/PDF consistency85 points
substanceData accuracy / Citations90 points

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相关技能