Task Objective
- This Skill is used to: convert PPT content in JSON format into standard .pptx files
- Capabilities include: JSON parsing, PPTX creation, multi-layout support, style application, chart generation, table generation
- Trigger conditions: the user needs to generate a .pptx file, or needs to convert JSON data into an editable PPT
Prerequisites
- Dependency description: dependency packages required by the scripts
python-pptx>=1.0.2 pillow>=9.0.0 openpyxl>=3.1.0
Operation Steps
Standard Process (JSON to PPTX)
Step 1: Receive JSON Data
Receive JSON data from the following sources:
- ppt-generator Skill: JSON generated by 7-role collaboration
- Directly provided by the user: a JSON file that conforms to the format specification
- Other sources: any PPT data that conforms to JSON format
Step 2: Validate JSON Format
Call scripts/json_validator.py to validate the JSON format:
python scripts/json_validator.py --input ./ppt_data.json
Validation includes:
- Metadata completeness (title, author, theme)
- Existence of the slides array
- Required fields for each slide (title, content)
- Correctness of data types
Step 3: Generate PPTX File
Call scripts/pptx_builder.py to generate the .pptx file:
python scripts/pptx_builder.py \
--input ./ppt_data.json \
--style assets/styles/modern.json \
--output ./presentation.pptx
Core Features:
- Create presentation: initialize the Presentation object
- Add slides: add page by page according to the JSON data
- Apply layout: select a layout according to the slide type
- Add content:
- Title
- Content (Text, Bullet Points)
- Picture
- Chart
- Table
- Apply styles: set fonts, colors, and spacing according to the style configuration
- Save file: export as a .pptx file
Step 4: Validate PPTX File
Call scripts/pptx_validator.py to validate the generated .pptx file:
python scripts/pptx_validator.py --input ./presentation.pptx
Validation includes:
- File integrity
- Number of slides
- Content correctness
- Editability
Advanced Features
Custom Styles
Use custom style configuration:
python scripts/pptx_builder.py \
--input ./ppt_data.json \
--style ./custom_style.json \
--output ./presentation.pptx
Batch Generation
Batch process multiple JSON files:
python scripts/pptx_builder.py \
--input-dir ./json_files/ \
--style assets/styles/modern.json \
--output-dir ./pptx_files/
Use Templates
Generate PPTX based on a template:
python scripts/pptx_builder.py \
--input ./ppt_data.json \
--template assets/templates/business_template.pptx \
--output ./presentation.pptx
Collaborate with Other Skills
Collaborate with ppt-generator
用户请求:"生成一个 PPT 文件"
┌─────────────────────────────────────────────────────────┐
│ ppt-generator Skill │
├─────────────────────────────────────────────────────────┤
│ 1. 主题分析师:分析主题 │
│ 2. 模板设计师:推荐布局 │
│ 3. 内容策划师:规划内容结构 │
│ 4. 文本创作者:撰写内容 │
│ 5. 视觉设计师:提供配图建议 │
│ 6. 优化编辑师:优化文本 │
│ 7. PPT 构建师:生成 JSON 数据 │
└─────────────────────────────────────────────────────────┘
│
▼ ppt_data.json
┌─────────────────────────────────────────────────────────┐
│ pptx-generator Skill │
├─────────────────────────────────────────────────────────┤
│ 1. JSON 验证(json_validator.py) │
│ 2. PPTX 构建(pptx_builder.py) │
│ - 创建演示文稿 │
│ - 添加幻灯片 │
│ - 应用布局和样式 │
│ - 添加内容(文本、图片、图表、表格) │
│ 3. PPTX 验证(pptx_validator.py) │
│ 4. 输出 .pptx 文件 │
└─────────────────────────────────────────────────────────┘
│
▼ presentation.pptx
Collaborate with nanobanana-ppt-visualizer
用户请求:"生成 PPT 文件和图片"
ppt-generator → pptx-generator → nanobanana-ppt-visualizer
↓ ↓ ↓
JSON 数据 .pptx 文件 图片 + HTML 播放器
Complete Workflow
1. ppt-generator → JSON 数据
2. pptx-generator → .pptx 文件
3. nanobanana-ppt-visualizer → 图片 + HTML 播放器
4. ppt-roadshow-generator → 视频
5. remotion-video-enhancer → 增强动画
Resource Index
- JSON validation script: see scripts/json_validator.py(Purpose: validate JSON format)
- PPTX build script: see scripts/pptx_builder.py(Purpose: generate .pptx file)
- PPTX validation script: see scripts/pptx_validator.py(Purpose: validate .pptx file)
- Format specification: see references/json_format_spec.md(Purpose: JSON format standard)
- Layout guide: see references/layout_guide.md(Purpose: layout type description)
- Style configuration: see assets/styles/(Optional: modern, minimal, business)
- Collaboration guide: see references/collaboration_guide.md(Purpose: collaborate with other Skills)
Notes
- This Skill uses the python-pptx library to generate standard .pptx files
- The JSON format must conform to the specification (see references/json_format_spec.md)
- Supported image formats: PNG, JPG, JPEG, GIF
- Supported chart types: bar chart, line chart, pie chart
- Supported tables: regular tables, styled tables
- Fully compatible with the ppt-generator Skill, enabling seamless collaboration
- The generated .pptx files can be edited in Microsoft PowerPoint, WPS, and other software
Usage Examples
Example 1: Collaborate with ppt-generator to generate PPTX
- Function description: ppt-generator generates JSON, pptx-generator generates .pptx
- Execution method: ppt-generator → pptx-generator
- User instruction: "Generate a PPT file for a product introduction"
- Output: presentation.pptx
Example 2: Generate only a PPTX file
- Function description: Generate a .pptx file based on existing JSON
- Execution method: pptx-generator runs independently
- Key parameters: JSON file path, style configuration
- Command:
python scripts/pptx_builder.py --input ./ppt_data.json --output ./presentation.pptx
Example 3: Custom style generation
- Function description: Use a custom style configuration
- Execution method: Specify a custom style file
- Key parameter: --style
- Command:
python scripts/pptx_builder.py --input ./ppt_data.json --style ./my_style.json --output ./presentation.pptx
Example 4: Batch generate PPTX files
- Function description: Process multiple JSON files at once
- Execution method: Batch processing
- Key parameters: --input-dir, --output-dir
- Command:
python scripts/pptx_builder.py --input-dir ./json_files/ --output-dir ./pptx_files/