pptx
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePPT演示文稿处理专家 Real Skill
PPT演示文稿处理专家 Real Skill
一句话说明
一句话说明
从 HTML 自动生成精美 PPT,支持演示文稿编辑、批注管理和内容提取。
Presentation Creation & Editing - Creating presentations from HTML, editing content, managing comments, extracting text.
从 HTML 自动生成精美 PPT,支持演示文稿编辑、批注管理和内容提取。
演示文稿创建与编辑 - 从HTML创建演示文稿、编辑内容、管理批注、提取文本。
使用场景
使用场景
适用:
- 从数据/HTML 自动生成标准化 PPT 报告
- 创建精美的演示文稿(销售、培训、汇报)
- 提取 PPT 文本、批注、演讲者备注
- 修改幻灯片内容、布局、主题
- 批量生成多个演示文稿
不适用:
- 复杂动画制作(用专业软件 / use professional software)
- 实时协同编辑(用 Google Slides / use Google Slides for real-time collaboration)
适用:
- 从数据/HTML 自动生成标准化 PPT 报告
- 创建精美的演示文稿(销售、培训、汇报)
- 提取 PPT 文本、批注、演讲者备注
- 修改幻灯片内容、布局、主题
- 批量生成多个演示文稿
不适用:
- 复杂动画制作(使用专业软件)
- 实时协同编辑(使用Google Slides进行实时协同编辑)
核心流程
核心流程
用户需求 → 内容分析 → 配色选择 → 工具选择 → 生成 PPT → 验证输出
User request → Content analysis → Color palette → Tool selection → Generate PPT → Validate任务类型判断 (Task Classification):
用户需求 → 内容分析 → 配色选择 → 工具选择 → 生成 PPT → 验证输出
用户需求 → 内容分析 → 配色方案 → 工具选择 → 生成PPT → 验证结果任务类型判断:
Creating Presentations (创建演示文稿)
创建演示文稿
-
HTML to PPT Workflow (推荐 / RECOMMENDED)
- Write HTML slides with styling
- Convert using html2pptx library
- Accurate positioning and formatting
- Web-safe fonts only (Arial, Helvetica, Georgia, etc.)
-
Python-PPTX Workflow
- Programmatic slide creation
- Batch generation from data
- Template-based automation
-
HTML转PPT工作流(推荐)
- 编写带有样式的HTML幻灯片
- 使用html2pptx库进行转换
- 精准定位与格式设置
- 仅使用Web安全字体(Arial、Helvetica、Georgia等)
-
Python-PPTX工作流
- 程序化创建幻灯片
- 从数据批量生成
- 基于模板的自动化
Reading & Analysis (读取与分析)
读取与分析
- Text extraction → markitdown (convert to markdown)
- Comments & Notes → Unpack OOXML and read XML
- Design analysis → Extract theme, colors, fonts from XML
- 文本提取 → 使用markitdown转换为markdown格式
- 批注与备注 → 解压OOXML并读取XML内容
- 设计分析 → 从XML中提取主题、颜色与字体
Editing Existing (编辑已有文稿)
编辑已有文稿
- Simple edits → python-pptx library
- Complex edits → Unpack OOXML, modify XML, repack
- 简单编辑 → 使用python-pptx库
- 复杂编辑 → 解压OOXML、修改XML、重新打包
任务完成标准
任务完成标准
必须满足(缺一不可):
- PPT 可正常打开并播放
- 幻灯片内容清晰可读
- 配色协调,视觉层次分明
- 布局合理,文字不拥挤
质量评级:
- ⭐⭐⭐⭐⭐ 优秀 - 设计精美 + 内容完整 + 自动化生成
- ⭐⭐⭐ 及格 - 内容正确 + PPT 可用 + 格式规范
- ⭐ 失败 - PPT 损坏或内容错误
必须满足(缺一不可):
- PPT 可正常打开并播放
- 幻灯片内容清晰可读
- 配色协调,视觉层次分明
- 布局合理,文字不拥挤
质量评级:
- ⭐⭐⭐⭐⭐ 优秀 - 设计精美 + 内容完整 + 自动化生成
- ⭐⭐⭐ 及格 - 内容正确 + PPT 可用 + 格式规范
- ⭐ 失败 - PPT 损坏或内容错误
参考资料(供 AI 使用)
参考资料(供AI使用)
| 类型 | 路径 | 说明 |
|---|---|---|
| 核心文档 | | Complete PPT creation guide (~500 lines) |
| OOXML库 | | Low-level XML operations |
| 工具脚本 | | Unpack PPTX files |
| 工具脚本 | | Pack PPTX files |
| 类型 | 路径 | 说明 |
|---|---|---|
| 核心文档 | | 完整PPT创建指南(约500行) |
| OOXML库 | | 底层XML操作工具 |
| 工具脚本 | | 解压PPTX文件 |
| 工具脚本 | | 打包PPTX文件 |
关键原则(AI 必读 / Critical Principles)
关键原则(AI必读)
1. Design First - Content-Informed Approach (设计先行)
1. 设计先行 - 基于内容的方法
CRITICAL: Before creating any presentation, analyze the content:
- Consider subject matter: What is this about? What tone/industry/mood?
- Check branding: If company mentioned, consider brand colors
- Match palette to content: Select colors reflecting the subject
- State your approach: Explain design choices BEFORE writing code
重要提示:在创建任何演示文稿之前,先分析内容:
- 考虑主题:演示文稿的主题是什么?适合什么风格/行业/氛围?
- 检查品牌规范:如果提及公司,需考虑品牌配色
- 配色方案匹配内容:选择符合主题的颜色
- 说明设计思路:在编写代码前先解释设计选择
2. Web-Safe Fonts Only (仅使用 Web 安全字体)
2. 仅使用Web安全字体
Allowed fonts: Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact
- No custom fonts: They won't render correctly
- Font pairing: Use max 2-3 fonts per presentation
允许使用的字体:Arial、Helvetica、Times New Roman、Georgia、Courier New、Verdana、Tahoma、Trebuchet MS、Impact
- 禁止自定义字体:无法正确渲染
- 字体搭配:每份演示文稿最多使用2-3种字体
3. Visual Hierarchy (视觉层次)
3. 视觉层次
- Extreme size contrast: 72pt headlines vs 11pt body text
- Weight variation: Bold headers, normal body, light captions
- Color emphasis: Use accent color for key information
- Clear structure: Title → Main content → Supporting details
- 极端字号对比:72pt标题 vs 11pt正文
- 字重变化:加粗标题、常规正文、轻量说明文字
- 颜色强调:使用强调色突出关键信息
- 清晰结构:标题 → 主要内容 → 辅助细节
4. Chart & Table Layout Rules (图表布局规则)
4. 图表与表格布局规则
PREFERRED - Two-column layout:
- Header spanning full width
- Text/bullets in one column (40%) + Chart/table in other (60%)
- Better balance and readability
Alternative - Full-slide layout:
- Chart/table takes entire slide for maximum impact
NEVER vertically stack:
- ❌ Do NOT place charts/tables below text in single column
- ❌ Causes poor readability and layout issues
首选 - 双栏布局:
- 标题横跨整个宽度
- 文本/项目符号占一栏(40%)+ 图表/表格占另一栏(60%)
- 平衡感与可读性更佳
备选 - 整页布局:
- 图表/表格占据整个幻灯片,最大化视觉冲击
绝对禁止垂直堆叠:
- ❌ 不要在单栏中将图表/表格放在文本下方
- ❌ 会导致可读性差与布局问题
5. Color Palette Selection (18种配色方案)
5. 配色方案选择(18种配色方案)
Think beyond defaults: What colors genuinely match this topic?
Consider multiple angles: Topic, industry, mood, energy, audience, brand
Be adventurous: Healthcare doesn't have to be green, finance doesn't have to be navy
超越默认:哪些颜色真正匹配主题?
多维度考量:主题、行业、氛围、受众、品牌
大胆创新:医疗行业不一定用绿色,金融行业不一定用藏青色
18种精选配色方案 (Color Palettes)
18种精选配色方案
Business & Professional (商业/专业)
商业与专业风格
- Classic Blue: Navy (#1C2833), Slate (#2E4053), Silver (#AAB7B8), Off-white (#F4F6F6)
- Black & Gold: Gold (#BF9A4A), Black (#000000), Cream (#F4F6F6)
- Charcoal & Red: Charcoal (#292929), Red (#E33737), Light Gray (#CCCBCB)
- 经典蓝:藏青 (#1C2833)、灰蓝 (#2E4053)、银灰 (#AAB7B8)、米白 (#F4F6F6)
- 黑金:金色 (#BF9A4A)、黑色 (#000000)、奶油白 (#F4F6F6)
- 炭灰与红:炭灰 (#292929)、红色 (#E33737)、浅灰 (#CCCBCB)
Creative & Vibrant (创意/活力)
创意与活力风格
- Teal & Coral: Teal (#5EA8A7), Deep Teal (#277884), Coral (#FE4447), White (#FFFFFF)
- Retro Rainbow: Purple (#722880), Pink (#D72D51), Orange (#EB5C18), Amber (#F08800), Gold (#DEB600)
- Vibrant Orange: Orange (#F96D00), Light Gray (#F2F2F2), Charcoal (#222831)
- Bold Red: Red (#C0392B), Bright Red (#E74C3C), Orange (#F39C12), Yellow (#F1C40F), Green (#2ECC71)
- 水鸭蓝与珊瑚橙:水鸭蓝 (#5EA8A7)、深水鸭蓝 (#277884)、珊瑚橙 (#FE4447)、白色 (#FFFFFF)
- 复古彩虹:紫色 (#722880)、粉色 (#D72D51)、橙色 (#EB5C18)、琥珀色 (#F08800)、金色 (#DEB600)
- 活力橙:橙色 (#F96D00)、浅灰 (#F2F2F2)、炭灰 (#222831)
- 醒目红:红色 (#C0392B)、亮红 (#E74C3C)、橙色 (#F39C12)、黄色 (#F1C40F)、绿色 (#2ECC71)
Natural & Warm (自然/温暖)
自然与温暖风格
- Sage & Terracotta: Sage (#87A96B), Terracotta (#E07A5F), Cream (#F4F1DE), Charcoal (#2C2C2C)
- Forest Green: Black (#191A19), Green (#4E9F3D), Dark Green (#1E5128), White (#FFFFFF)
- Vintage Earthy: Mustard (#E3B448), Sage (#CBD18F), Forest Green (#3A6B35), Cream (#F4F1DE)
- Cream & Forest: Cream (#FFE1C7), Forest Green (#40695B), White (#FCFCFC)
- 鼠尾草绿与赤陶色:鼠尾草绿 (#87A96B)、赤陶色 (#E07A5F)、奶油白 (#F4F1DE)、炭灰 (#2C2C2C)
- 森林绿:黑色 (#191A19)、绿色 (#4E9F3D)、深绿 (#1E5128)、白色 (#FFFFFF)
- 复古大地色:芥末黄 (#E3B448)、鼠尾草绿 (#CBD18F)、森林绿 (#3A6B35)、奶油白 (#F4F1DE)
- 奶油白与森林绿:奶油白 (#FFE1C7)、森林绿 (#40695B)、白色 (#FCFCFC)
Elegant & Soft (优雅/柔和)
优雅与柔和风格
- Warm Blush: Mauve (#A49393), Blush (#EED6D3), Rose (#E8B4B8), Cream (#FAF7F2)
- Coastal Rose: Old Rose (#AD7670), Beaver (#B49886), Eggshell (#F3ECDC), Ash Gray (#BFD5BE)
- Pink & Purple: Pink (#F8275B), Coral (#FF574A), Rose (#FF737D), Purple (#3D2F68)
- 暖腮红:淡紫褐 (#A49393)、腮红粉 (#EED6D3)、玫瑰粉 (#E8B4B8)、奶油白 (#FAF7F2)
- 海岸玫瑰:旧玫瑰色 (#AD7670)、海狸棕 (#B49886)、蛋壳白 (#F3ECDC)、灰绿 (#BFD5BE)
- 粉紫:粉色 (#F8275B)、珊瑚橙 (#FF574A)、玫瑰粉 (#FF737D)、紫色 (#3D2F68)
Luxury & Bold (奢华/大胆)
奢华与大胆风格
- Burgundy Luxury: Burgundy (#5D1D2E), Crimson (#951233), Rust (#C15937), Gold (#997929)
- Deep Purple & Emerald: Purple (#B165FB), Dark Blue (#181B24), Emerald (#40695B), White (#FFFFFF)
- 勃艮第奢华:勃艮第红 (#5D1D2E)、绯红 (#951233)、铁锈红 (#C15937)、金色 (#997929)
- 深紫与祖母绿:紫色 (#B165FB)、深蓝 (#181B24)、祖母绿 (#40695B)、白色 (#FFFFFF)
Fresh & Modern (清新/现代)
清新与现代风格
- Lime & Plum: Lime (#C5DE82), Plum (#7C3A5F), Coral (#FD8C6E), Blue-Gray (#98ACB5)
- Orange & Turquoise: Light Orange (#FC993E), Grayish Turquoise (#667C6F), White (#FCFCFC)
- 酸橙绿与李子紫:酸橙绿 (#C5DE82)、李子紫 (#7C3A5F)、珊瑚橙 (#FD8C6E)、蓝灰 (#98ACB5)
- 橙与绿松石:浅橙 (#FC993E)、灰绿松石 (#667C6F)、白色 (#FCFCFC)
快速命令参考 (Quick Commands)
快速命令参考
Text Extraction (文本提取)
文本提取
bash
undefinedbash
undefinedConvert PPTX to markdown
将PPTX转换为markdown
python -m markitdown presentation.pptx
undefinedpython -m markitdown presentation.pptx
undefinedCreate Simple Presentation (创建简单演示文稿)
创建简单演示文稿
python
from pptx import Presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0]) # Title slide
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Hello World!"
subtitle.text = "My First Presentation"
prs.save("output.pptx")python
from pptx import Presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0]) # 标题幻灯片
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Hello World!"
subtitle.text = "My First Presentation"
prs.save("output.pptx")Unpack PPTX for Analysis (解压分析)
解压PPTX进行分析
bash
undefinedbash
undefinedUnpack PPTX to access raw XML
解压PPTX以访问原始XML
python ooxml/scripts/unpack.py presentation.pptx output_dir
python ooxml/scripts/unpack.py presentation.pptx output_dir
Key files to examine:
需重点查看的文件:
ppt/presentation.xml - Main metadata
ppt/presentation.xml - 主元数据
ppt/slides/slide1.xml - Individual slide contents
ppt/slides/slide1.xml - 单张幻灯片内容
ppt/theme/theme1.xml - Theme colors and fonts
ppt/theme/theme1.xml - 主题颜色与字体
ppt/comments/ - Comments
ppt/comments/ - 批注
ppt/notesSlides/ - Speaker notes
ppt/notesSlides/ - 演讲者备注
undefinedundefinedRepack After Editing (编辑后打包)
编辑后重新打包
bash
undefinedbash
undefinedPack modified XML back to PPTX
将修改后的XML重新打包为PPTX
python ooxml/scripts/pack.py output_dir new_presentation.pptx
undefinedpython ooxml/scripts/pack.py output_dir new_presentation.pptx
undefinedHTML to PPT Workflow (HTML 转 PPT)
HTML转PPT工作流
python
undefinedpython
undefinedStep 1: Write HTML slides
步骤1: 编写HTML幻灯片
html_content = """
<!DOCTYPE html>
<html>
<head>
<style>
.slide { width: 960px; height: 720px; padding: 40px; }
h1 { font-family: Arial; font-size: 48px; color: #1C2833; }
p { font-family: Arial; font-size: 24px; color: #2E4053; }
</style>
</head>
<body>
<div class="slide">
<h1>Welcome</h1>
<p>This is my presentation</p>
</div>
</body>
</html>
"""html_content = """
<!DOCTYPE html>
<html>
<head>
<style>
.slide { width: 960px; height: 720px; padding: 40px; }
h1 { font-family: Arial; font-size: 48px; color: #1C2833; }
p { font-family: Arial; font-size: 24px; color: #2E4053; }
</style>
</head>
<body>
<div class="slide">
<h1>Welcome</h1>
<p>This is my presentation</p>
</div>
</body>
</html>
"""Step 2: Convert to PPTX
步骤2: 转换为PPTX
from html2pptx import html2pptx
with open("slides.html", "w") as f:
f.write(html_content)
html2pptx("slides.html", "output.pptx")
---from html2pptx import html2pptx
with open("slides.html", "w") as f:
f.write(html_content)
html2pptx("slides.html", "output.pptx")
---依赖安装 (Dependencies Installation)
依赖安装
Python Dependencies
Python依赖项
bash
pip install -r requirements.txtbash
pip install -r requirements.txtIncludes: python-pptx, html2pptx, markitdown
包含: python-pptx, html2pptx, markitdown
---
---常见场景示例 (Common Scenarios)
常见场景示例
Scenario 1: Create Professional Title Slide (创建专业标题页)
场景1: 创建专业标题页
python
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6]) # Blank layoutpython
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6]) # 空白布局Add title
添加标题
left = Inches(1)
top = Inches(2.5)
width = Inches(8)
height = Inches(1.5)
title_box = slide.shapes.add_textbox(left, top, width, height)
title_frame = title_box.text_frame
title_frame.text = "2024 Sales Report"
left = Inches(1)
top = Inches(2.5)
width = Inches(8)
height = Inches(1.5)
title_box = slide.shapes.add_textbox(left, top, width, height)
title_frame = title_box.text_frame
title_frame.text = "2024 Sales Report"
Format title
格式化标题
title_para = title_frame.paragraphs[0]
title_para.font.size = Pt(72)
title_para.font.bold = True
title_para.font.color.rgb = RGBColor(28, 40, 51) # Navy
title_para = title_frame.paragraphs[0]
title_para.font.size = Pt(72)
title_para.font.bold = True
title_para.font.color.rgb = RGBColor(28, 40, 51) # 藏青色
Add subtitle
添加副标题
subtitle_box = slide.shapes.add_textbox(left, Inches(4), width, Inches(0.5))
subtitle_frame = subtitle_box.text_frame
subtitle_frame.text = "Q4 Performance Review"
subtitle_para = subtitle_frame.paragraphs[0]
subtitle_para.font.size = Pt(24)
subtitle_para.font.color.rgb = RGBColor(46, 64, 83) # Slate
prs.save("title_slide.pptx")
undefinedsubtitle_box = slide.shapes.add_textbox(left, Inches(4), width, Inches(0.5))
subtitle_frame = subtitle_box.text_frame
subtitle_frame.text = "Q4 Performance Review"
subtitle_para = subtitle_frame.paragraphs[0]
subtitle_para.font.size = Pt(24)
subtitle_para.font.color.rgb = RGBColor(46, 64, 83) # 灰蓝色
prs.save("title_slide.pptx")
undefinedScenario 2: Extract All Speaker Notes (提取所有演讲者备注)
场景2: 提取所有演讲者备注
bash
undefinedbash
undefinedStep 1: Unpack PPTX
步骤1: 解压PPTX
python ooxml/scripts/unpack.py presentation.pptx unpacked/
python ooxml/scripts/unpack.py presentation.pptx unpacked/
Step 2: Extract notes using grep
步骤2: 使用grep提取备注
cd unpacked/ppt/notesSlides/
grep -r "a:t>" . | sed 's/<[^>]*>//g' > ../../all_notes.txt
undefinedcd unpacked/ppt/notesSlides/
grep -r "a:t>" . | sed 's/<[^>]*>//g' > ../../all_notes.txt
undefinedScenario 3: Batch Generate Slides from Data (批量生成幻灯片)
场景3: 从数据批量生成幻灯片
python
from pptx import Presentation
from pptx.util import Inches, Pt
data = [
{"name": "Product A", "sales": 1200, "growth": "15%"},
{"name": "Product B", "sales": 980, "growth": "8%"},
{"name": "Product C", "sales": 1450, "growth": "22%"}
]
prs = Presentation()
for item in data:
slide = prs.slides.add_slide(prs.slide_layouts[1]) # Title and content
title = slide.shapes.title
title.text = item["name"]
body = slide.placeholders[1]
tf = body.text_frame
tf.text = f"Sales: ${item['sales']}M"
p = tf.add_paragraph()
p.text = f"Growth: {item['growth']}"
p.level = 1
prs.save("batch_report.pptx")python
from pptx import Presentation
from pptx.util import Inches, Pt
data = [
{"name": "Product A", "sales": 1200, "growth": "15%"},
{"name": "Product B", "sales": 980, "growth": "8%"},
{"name": "Product C", "sales": 1450, "growth": "22%"}
]
prs = Presentation()
for item in data:
slide = prs.slides.add_slide(prs.slide_layouts[1]) # 标题与内容布局
title = slide.shapes.title
title.text = item["name"]
body = slide.placeholders[1]
tf = body.text_frame
tf.text = f"Sales: ${item['sales']}M"
p = tf.add_paragraph()
p.text = f"Growth: {item['growth']}"
p.level = 1
prs.save("batch_report.pptx")
```",