pptx-generator

Solid

将 JSON 格式的 PPT 内容转换为标准的 .pptx 文件。使用 python-pptx 库,支持多种布局、图表、表格和样式。与 ppt-generator Skill 完全协同,可作为独立使用或与其他 PPT Skill 配合。

Data & Documents 1,525 stars 170 forks Updated today

Install

View on GitHub

Quality Score: 86/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
0
Description 5%
100

Skill Content

# PPTX 文件生成器 ## 任务目标 - 本 Skill 用于:将 JSON 格式的 PPT 内容转换为标准的 .pptx 文件 - 能力包含:JSON 解析、PPTX 创建、多布局支持、样式应用、图表生成、表格生成 - 触发条件:用户需要生成 .pptx 文件,或需要将 JSON 数据转换为可编辑的 PPT ## 前置准备 - 依赖说明:scripts 脚本所需的依赖包 ``` python-pptx>=1.0.2 pillow>=9.0.0 openpyxl>=3.1.0 ``` ## 操作步骤 ### 标准流程(JSON 转 PPTX) #### 步骤 1:接收 JSON 数据 从以下来源接收 JSON 数据: - **ppt-generator Skill**:7 角色协作生成的 JSON - **用户直接提供**:符合格式规范的 JSON 文件 - **其他来源**:任何符合 JSON 格式的 PPT 数据 #### 步骤 2:验证 JSON 格式 调用 `scripts/json_validator.py` 验证 JSON 格式: ```bash python scripts/json_validator.py --input ./ppt_data.json ``` 验证内容包括: - 元数据完整性(title, author, theme) - 幻灯片数组存在性 - 每个幻灯片的必需字段(title, content) - 数据类型正确性 #### 步骤 3:生成 PPTX 文件 调用 `scripts/pptx_builder.py` 生成 .pptx 文件: ```bash python scripts/pptx_builder.py \ --input ./ppt_data.json \ --style assets/styles/modern.json \ --output ./presentation.pptx ``` **核心功能**: 1. **创建演示文稿**:初始化 Presentation 对象 2. **添加幻灯片**:根据 JSON 数据逐页添加 3. **应用布局**:根据幻灯片类型选择布局 4. **添加内容**: - 标题(Title) - 内容(Text、Bullet Points) - 图片(Picture) - 图表(Chart) - 表格(Table) 5. **应用样式**:根据风格配置设置字体、颜色、间距 6. **保存文件**:导出为 .pptx 文件 #### 步骤 4:验证 PPTX 文件 调用 `scripts/pptx_validator.py` 验证生成的 .pptx 文件: ```bash python scripts/pptx_validator.py --input ./presentation.pptx ``` 验证内容包括: - 文件完整性 - 幻灯片数量 - 内容正确性 - 可编辑性 ### 高级功能 #### 自定义样式 使用自定义风格配置: ```bash python scripts/pptx_builder.py \ --input ./ppt_data.json \ --style ./custom_style.json \ --output ./presentation.pptx ``` #### 批量生成 批量处理多个 JSON 文件: ```bash ...

Details

Author
anbeime
Repository
anbeime/skill
Created
4 months ago
Last Updated
today
Language
Python
License
None

Similar Skills

Semantically similar based on skill content — not just same category