← 返回
未分类

PPT小助手

Use when the user asks to generate, create, or make a PPT/PowerPoint presentation, slides, or .pptx file. Supports both natural language descriptions and Markdown outlines as input. Covers teaching materials, business reports, project summaries, and general presentations.
Use when the user asks to generate, create, or make a PPT/PowerPoint presentation, slides, or .pptx file. Supports both natural language descriptions and Markdown outlines as input. Covers teaching materials, business reports, project summaries, and general presentations.
user_0e56f9a3
未分类 community v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 118
下载
💾 0
安装
1
版本
#latest

概述

PPT Generator

Overview

Generate professional .pptx files using python-pptx. Accept input as natural language ("make a 10-slide deck about AI safety") or structured Markdown outlines.

Workflow

  1. Parse input — extract topic, slide count, style hints from user's natural language or Markdown outline
  2. Design outline — plan each slide: layout type, title, content summary
  3. Present outline to user — show a numbered slide list for confirmation before writing code
  4. Generate script — write a self-contained Python script using python-pptx
  5. Execute and verify — run the script, confirm the .pptx file was created

Never skip step 3. Always get user approval on the outline before writing code.

Typography Rules

These are mandatory defaults. Only deviate if the user explicitly overrides.

ElementFont SizeWeightColor
-----------------------------------
Slide title32ptBold#1a1a2e
Subtitle18ptNormal#555555
Body text14ptNormal#333333
Small label11ptNormal#888888

Margins: left/right 1.5 inch, top/bottom 1.2 inch (when using manual text boxes). For built-in layouts, leave at defaults.

Color Themes

Four preset themes. Default is "Professional Blue". User can switch by name.

ThemePrimarySecondaryAccentBackground
-----------------------------------------------
Professional Blue#1a1a2e#16213e#0f3460#ffffff
Warm Orange#e07a5f#3d405b#81b29a#f4f1de
Clean Green#2d6a4f#40916c#52b788#ffffff
Dark Mode#e0e0e0#bb86fc#03dac6#121212

Slide Types

Title Slide

Centered title, subtitle, author/date. Use PPT_LAYOUT_TITLE (layout index 0).

Content Slide (Bullet List)

Title at top, bullet points in body. Use PPT_LAYOUT_BODY (layout index 1) or manual text box for multi-level lists.

Two-Column

Title, two text columns side by side. Use manual text boxes positioned at 0.5" and 5.0" horizontally.

Image + Text

Title, image on one side, text on the other. Use add_picture() with manual placement.

Table Slide

Title + table. Use add_table(rows, cols).

Ending Slide

Centered "Thank You" or "Q&A" with contact info. Same layout as title slide.

Code Patterns

Bootstrap every script like this:

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
import os

prs = Presentation()
prs.slide_width = Inches(13.333)  # 16:9 widescreen
prs.slide_height = Inches(7.5)

# Theme colors (Professional Blue)
PRIMARY = RGBColor(0x1a, 0x1a, 0x2e)
SECONDARY = RGBColor(0x16, 0x21, 0x3e)
ACCENT = RGBColor(0x0f, 0x34, 0x60)
BG = RGBColor(0xff, 0xff, 0xff)

# Helper: add a text box
def add_textbox(slide, left, top, width, height, text, font_size=Pt(14),
                bold=False, color=RGBColor(0x33, 0x33, 0x33), alignment=PP_ALIGN.LEFT):
    txBox = slide.shapes.add_textbox(Inches(left), Inches(top),
                                      Inches(width), Inches(height))
    tf = txBox.text_frame
    tf.word_wrap = True
    p = tf.paragraphs[0]
    p.text = text
    p.font.size = font_size
    p.font.bold = bold
    p.font.color.rgb = color
    p.alignment = alignment
    return tf

# Helper: add bullet points from a list
def add_bullet_list(slide, left, top, width, height, items, font_size=Pt(14)):
    txBox = slide.shapes.add_textbox(Inches(left), Inches(top),
                                      Inches(width), Inches(height))
    tf = txBox.text_frame
    tf.word_wrap = True
    for i, item in enumerate(items):
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.text = item
        p.font.size = font_size
        p.font.color.rgb = RGBColor(0x33, 0x33, 0x33)
        p.level = 0
        p.space_after = Pt(6)
    return tf

Title slide:

slide = prs.slides.add_slide(prs.slide_layouts[6])  # blank layout
add_textbox(slide, 1.5, 2.0, 10, 1.5, "Presentation Title",
            Pt(36), True, PRIMARY, PP_ALIGN.CENTER)
add_textbox(slide, 1.5, 3.5, 10, 0.8, "Subtitle or Author",
            Pt(18), False, RGBColor(0x55, 0x55, 0x55), PP_ALIGN.CENTER)
add_textbox(slide, 1.5, 4.5, 10, 0.5, "2024-01-15",
            Pt(11), False, RGBColor(0x88, 0x88, 0x88), PP_ALIGN.CENTER)

Content slide with bullets:

slide = prs.slides.add_slide(prs.slide_layouts[6])
add_textbox(slide, 0.8, 0.4, 10, 0.8, "Slide Title", Pt(32), True, PRIMARY)
items = ["Point one: key insight", "Point two: supporting detail", "Point three: takeaway"]
add_bullet_list(slide, 1.0, 1.5, 11, 4.5, items)

Save the file:

output_path = os.path.expanduser("~/Desktop/presentation.pptx")
prs.save(output_path)
print(f"Saved to {output_path}")

Input Formats

Natural Language

User says: "做一个关于时间管理的5页PPT"

→ Claude designs the outline, presents it, then generates.

Markdown Outline

User provides:

# 时间管理
## 1. 为什么需要时间管理
- 提高效率
- 减少压力
## 2. 四象限法则
- 重要紧急
- 重要不紧急
...

→ Claude maps each ## heading to a slide, each bullet to a list item, and generates.

Common Mistakes

MistakeFix
--------------
Text overflowing slideBreak long text into multiple slides or reduce font size
Missing font file for ChineseAlways use a font that supports CJK (e.g., "Microsoft YaHei", "SimSun"). Add p.font.name = 'Microsoft YaHei' for Chinese text
Using wrong layout indexLayout 0 = title, 1 = content, 6 = blank. Check with prs.slide_layouts if unsure
Forgetting Inches/Pt wrappersAll dimensions must use Inches() or Pt() from pptx.util
Not setting word_wrapLong text without word_wrap = True overflows horizontally

Reference Files

  • reference/python-pptx-api.md — Full python-pptx API quick reference
  • scripts/ppt_helpers.py — Ready-to-import helper functions for common slide patterns

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-05-23 18:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 464 📥 155,060
office-efficiency

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 387 📥 147,380
office-efficiency

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 279 📥 116,825