Skip to content

anbeime/skill / skills/pptx-generator/pptx-generator

pptx-generator

Unverified

产品经理与运营专员在准备汇报展示时,将 JSON 数据一键转换为标准 .pptx 文件。自动应用多种布局、图表与表格样式,快速生成专业 PPT,彻底告别繁琐手工排版,让内容产出与展示更高效!

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 格式:

python scripts/json_validator.py --input ./ppt_data.json

验证内容包括:

  • 元数据完整性(title, author, theme)
  • 幻灯片数组存在性
  • 每个幻灯片的必需字段(title, content)
  • 数据类型正确性

步骤 3:生成 PPTX 文件

调用 scripts/pptx_builder.py 生成 .pptx 文件:

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 文件:

python scripts/pptx_validator.py --input ./presentation.pptx

验证内容包括:

  • 文件完整性
  • 幻灯片数量
  • 内容正确性
  • 可编辑性

高级功能

自定义样式

使用自定义风格配置:

python scripts/pptx_builder.py \
  --input ./ppt_data.json \
  --style ./custom_style.json \
  --output ./presentation.pptx

批量生成

批量处理多个 JSON 文件:

python scripts/pptx_builder.py \
  --input-dir ./json_files/ \
  --style assets/styles/modern.json \
  --output-dir ./pptx_files/

使用模板

基于模板生成 PPTX:

python scripts/pptx_builder.py \
  --input ./ppt_data.json \
  --template assets/templates/business_template.pptx \
  --output ./presentation.pptx

与其他 Skill 协同

与 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

与 nanobanana-ppt-visualizer 协同

用户请求:"生成 PPT 文件和图片"

ppt-generator → pptx-generator → nanobanana-ppt-visualizer
     ↓              ↓                  ↓
  JSON 数据      .pptx 文件        图片 + HTML 播放器

完整工作流

1. ppt-generator → JSON 数据
2. pptx-generator → .pptx 文件
3. nanobanana-ppt-visualizer → 图片 + HTML 播放器
4. ppt-roadshow-generator → 视频
5. remotion-video-enhancer → 增强动画

资源索引

注意事项

  • 本 Skill 使用 python-pptx 库生成标准的 .pptx 文件
  • JSON 格式必须符合规范(见 references/json_format_spec.md)
  • 支持的图片格式:PNG、JPG、JPEG、GIF
  • 支持的图表类型:柱状图、折线图、饼图
  • 支持的表格:普通表格、样式化表格
  • 与 ppt-generator Skill 完全兼容,可无缝协同
  • 生成的 .pptx 文件可在 Microsoft PowerPoint、WPS 等软件中编辑

使用示例

示例 1:与 ppt-generator 协同生成 PPTX

  • 功能说明:ppt-generator 生成 JSON,pptx-generator 生成 .pptx
  • 执行方式:ppt-generator → pptx-generator
  • 用户指令:"生成一个产品介绍的 PPT 文件"
  • 输出:presentation.pptx

示例 2:仅生成 PPTX 文件

  • 功能说明:基于现有 JSON 生成 .pptx 文件
  • 执行方式:pptx-generator 独立运行
  • 关键参数:JSON 文件路径、风格配置
  • 命令:python scripts/pptx_builder.py --input ./ppt_data.json --output ./presentation.pptx

示例 3:自定义风格生成

  • 功能说明:使用自定义风格配置
  • 执行方式:指定自定义风格文件
  • 关键参数:--style
  • 命令:python scripts/pptx_builder.py --input ./ppt_data.json --style ./my_style.json --output ./presentation.pptx

示例 4:批量生成 PPTX 文件

  • 功能说明:一次性处理多个 JSON 文件
  • 执行方式:批量处理
  • 关键参数:--input-dir, --output-dir
  • 命令:python scripts/pptx_builder.py --input-dir ./json_files/ --output-dir ./pptx_files/
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 196kUpdated Claude CodeCodexVerifiedInstall