Anthropic Skills 中文文档
首页
使用指南
技能列表
  • 🎨 创意与设计
  • 💻 开发与技术
  • 🏢 企业与沟通
  • 📄 文档处理
  • 🔧 元技能
  • GitHub 仓库
  • Claude 官网
  • Skills 官方文档
GitHub
首页
使用指南
技能列表
  • 🎨 创意与设计
  • 💻 开发与技术
  • 🏢 企业与沟通
  • 📄 文档处理
  • 🔧 元技能
  • GitHub 仓库
  • Claude 官网
  • Skills 官方文档
GitHub
  • 技能列表
  • 🎨 创意与设计

    • 🎨 算法艺术生成

      • 📋 概览
      • 📖 完整指南
    • 🖼️ 画布设计

      • 📋 概览
      • 📖 完整指南
    • 🎬 Slack GIF 创建器

      • 📋 概览
      • 📖 完整指南
    • 🎨 主题工厂

      • 📋 概览
      • 📖 完整指南
  • 💻 开发与技术

    • 🎨 Web 组件构建器

      • 📋 概览
      • 📖 完整指南
    • 📦 MCP 服务器构建器

      • 📋 概览
      • 📖 完整指南
    • 🧪 Web 应用测试工具

      • 📋 概览
      • 📖 完整指南
  • 🏢 企业与沟通

    • 🎨 品牌指南

      • 📋 概览
      • 📖 完整指南
    • 📢 企业内部沟通

      • 📋 概览
      • 📖 完整指南
    • 💎 前端设计

      • 📋 概览
      • 📖 完整指南
  • 📄 文档处理

    • 📘 Word 文档处理

      • 📋 概览
      • 📖 完整指南
    • 📕 PDF 文档处理

      • 📋 概览
      • 📖 完整指南
    • 📙 PowerPoint 演示文稿处理

      • 📋 概览
      • 📖 完整指南
    • 📗 Excel 表格处理

      • 📋 概览
      • 📖 完整指南
  • 🔧 元技能

    • 🛠️ Skill 创建器

      • 📋 概览
      • 📖 完整指南
    • 📝 Skill 模板

      • 📋 概览
      • 📖 完整参考

📙 PowerPoint 演示文稿处理 - 完整指南

本文档是 PowerPoint 演示文稿处理技能的完整技术参考,包含所有工作流程、设计指南和代码示例。

  • 📋 概述
  • 🔧 核心工具
    • 1. HTML → PPTX 工作流(创建新演示)
    • 2. python-pptx(编辑现有演示)
    • 3. markitdown(内容提取)
    • 4. OOXML 解析(深度访问)
  • 📊 工作流程详解
    • 工作流 1: 创建新演示(HTML2PPTX)
    • 工作流 2: 编辑现有演示(Python-PPTX)
    • 工作流 3: 分析和提取内容
  • 🎨 设计指南
    • 视觉层次原则
    • 布局最佳实践
    • 视觉细节选项
  • 📋 HTML 模板库
    • 模板 1: 标题页
    • 模板 2: 双列(文字 + 图表)
    • 模板 3: 数据卡片
    • 模板 4: 时间线
  • 🎯 最佳实践
    • 1. 文件命名规范
    • 2. 性能优化
    • 3. 版本控制
  • ⚠️ 常见问题
    • 问题 1: HTML 转 PPTX 后布局不准确
    • 问题 2: 中文字体显示异常
    • 问题 3: 图片分辨率模糊
    • 问题 4: 无法访问备注和评论
  • 🔗 参考资源
    • 官方文档
    • 设计灵感
  • 📝 总结

📋 概述

PowerPoint 演示文稿处理技能提供全面的 .pptx 文件操作方案:

  • 创建演示文稿 - 使用 HTML 转 PPTX 工作流,精确控制布局
  • 编辑演示文稿 - 修改文本、添加备注、更新设计元素
  • 分析演示文稿 - 提取文本、解析 XML 结构、访问高级元素
  • 设计系统 - 18 种配色方案、视觉细节选项、布局模式

🔧 核心工具

1. HTML → PPTX 工作流(创建新演示)

用途: 从零开始创建 PowerPoint,通过 HTML 精确控制布局

流程:

HTML 设计 → html2pptx.py → .pptx 文件

优点:

  • 完全控制布局和样式
  • 熟悉的 HTML/CSS 语法
  • 适合程序化生成

2. python-pptx(编辑现有演示)

用途: 修改现有 .pptx 文件的内容

安装: pip install python-pptx

适用场景:

  • 批量更新演示文稿
  • 添加新幻灯片
  • 修改文本和图片

3. markitdown(内容提取)

用途: 将 .pptx 转换为 Markdown

使用:

python -m markitdown presentation.pptx > output.md

4. OOXML 解析(深度访问)

用途: 访问备注、评论、动画、主题等高级元素

方法: 解包 .pptx(本质是 ZIP 文件),读取 XML


📊 工作流程详解

工作流 1: 创建新演示(HTML2PPTX)

这是推荐的创建方法,提供最大的灵活性和控制。

步骤 1: 分析内容和设计方向

在编写任何代码前,先思考:

  1. 内容主题是什么?

    • 商业报告?技术培训?营销提案?
  2. 目标受众是谁?

    • 高管?技术人员?普通客户?
  3. 适合的色调是什么?

    • 专业严肃?创新活力?温暖亲和?

示例分析:

任务: 创建"2024 年度销售总结"演示
分析:
- 主题: 商业/财务报告
- 受众: 公司高管和销售团队
- 色调: 专业、数据驱动、积极向上
- 配色: 选择商务蓝 + 金色强调
- 布局: 简洁清晰,突出数字和图表

步骤 2: 选择调色板

18 种精选调色板(根据内容选择):

商务专业系列:

  1. 经典蓝 - #1C2833(深海军蓝), #2E4053(石板灰), #AAB7B8(银色), #F4F6F6(米白)
  2. 深紫 + 翡翠 - #B165FB(紫色), #181B24(深蓝), #40695B(翡翠绿), #FFFFFF(白)

科技创新系列: 3. 青绿 + 珊瑚 - #5EA8A7(青绿), #277884(深青), #FE4447(珊瑚红) 4. 活力橙 - #F96D00(橙色), #F2F2F2(浅灰), #222831(炭灰)

温暖亲和系列: 5. 温暖胭脂 - #A49393(淡紫), #EED6D3(胭脂), #E8B4B8(玫瑰), #FAF7F2(奶油) 6. 复古橙 + 绿松石 - #FC993E(浅橙), #667C6F(灰绿松石), #FCFCFC(白)

大胆个性系列: 7. 勃艮第奢华 - #5D1D2E(勃艮第), #951233(深红), #C15937(锈色), #997929(金色) 8. 复古彩虹 - #722880(紫), #D72D51(粉红), #EB5C18(橙), #F08800(琥珀), #DEB600(金)

自然清新系列: 9. 鼠尾草 + 陶土 - #87A96B(鼠尾草), #E07A5F(陶土色), #F4F1DE(奶油), #2C2C2C(炭黑) 10. 森林绿 - #191A19(黑), #4E9F3D(绿), #1E5128(深绿), #FFFFFF(白)

更多配色方案详见完整列表

步骤 3: 设计布局

推荐的幻灯片布局模式:

标题页:

<div class="slide title-slide" style="background: #1C2833;">
  <div style="text-align: center; padding-top: 200px;">
    <h1 style="color: #F4F6F6; font-size: 48pt;">2024 年度销售总结</h1>
    <p style="color: #AAB7B8; font-size: 18pt;">销售部 | 2024年1月</p>
  </div>
</div>

双列布局(文字 + 图表):

<div class="slide">
  <h1>销售增长趋势</h1>
  <div style="display: flex;">
    <div style="flex: 0 0 40%; padding-right: 20px;">
      <h2>关键发现</h2>
      <ul>
        <li>Q4 增长 23%</li>
        <li>新客户 +87</li>
        <li>复购率 65%</li>
      </ul>
    </div>
    <div style="flex: 0 0 60%;">
      <img src="chart.png" style="width: 100%;">
    </div>
  </div>
</div>

要点列表:

<div class="slide">
  <h1>成功关键因素</h1>
  <ul style="font-size: 24pt; line-height: 1.6;">
    <li>产品创新驱动增长</li>
    <li>客户服务持续优化</li>
    <li>渠道拓展成效显著</li>
    <li>团队协作创新高</li>
  </ul>
</div>

全屏图表:

<div class="slide">
  <h1>年度业绩总览</h1>
  <div style="padding: 30px;">
    <img src="dashboard.png" style="width: 100%; height: auto;">
  </div>
</div>

步骤 4: 创建 HTML 文件

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <style>
    .slide {
      width: 960px;
      height: 540px;
      padding: 40px;
      box-sizing: border-box;
      font-family: Arial, sans-serif;
    }
    h1 { font-size: 36pt; color: #1C2833; margin-bottom: 20px; }
    h2 { font-size: 28pt; color: #2E4053; }
    p, li { font-size: 18pt; line-height: 1.5; color: #333; }
  </style>
</head>
<body>

<!-- 幻灯片 1: 标题 -->
<div class="slide" style="background: #1C2833; text-align: center; padding-top: 200px;">
  <h1 style="color: white;">2024 年度总结</h1>
  <p style="color: #AAB7B8;">销售部 | 2024-01</p>
</div>

<!-- 幻灯片 2: 双列布局 -->
<div class="slide">
  <h1>主要成果</h1>
  <div style="display: flex;">
    <div style="flex: 40%;">
      <ul>
        <li>营收增长 23%</li>
        <li>新客户 87 个</li>
        <li>市场份额 +5%</li>
      </ul>
    </div>
    <div style="flex: 60%;">
      <div style="background: #E8F4F8; padding: 40px; text-align: center;">
        <h2 style="font-size: 72pt; color: #1C2833;">¥125M</h2>
        <p style="color: #2E4053;">年度总收入</p>
      </div>
    </div>
  </div>
</div>

<!-- 更多幻灯片... -->

</body>
</html>

步骤 5: 转换为 PPTX

# 使用 html2pptx 转换
from html2pptx import html2pptx

html2pptx("slides.html", "output.pptx")

工作流 2: 编辑现有演示(Python-PPTX)

步骤 1: 安装和基础操作

pip install python-pptx
from pptx import Presentation

# 打开现有演示
prs = Presentation("existing.pptx")

# 查看幻灯片数量
print(f"共有 {len(prs.slides)} 张幻灯片")

# 查看布局
print(f"可用布局: {len(prs.slide_layouts)} 种")

步骤 2: 修改文本

from pptx import Presentation

prs = Presentation("report.pptx")

# 修改第一张幻灯片的标题
first_slide = prs.slides[0]
first_slide.shapes.title.text = "新的标题"

# 修改文本框内容
for shape in first_slide.shapes:
    if hasattr(shape, "text"):
        if "旧文本" in shape.text:
            shape.text = shape.text.replace("旧文本", "新文本")

prs.save("modified.pptx")

步骤 3: 添加新幻灯片

from pptx import Presentation
from pptx.util import Inches, Pt

prs = Presentation("template.pptx")

# 选择布局(通常 0 是标题页,1 是标题+内容)
title_slide_layout = prs.slide_layouts[0]
bullet_slide_layout = prs.slide_layouts[1]

# 添加标题幻灯片
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "新增幻灯片"
subtitle.text = "副标题内容"

# 添加内容幻灯片
slide = prs.slides.add_slide(bullet_slide_layout)
shapes = slide.shapes
title_shape = shapes.title
body_shape = shapes.placeholders[1]

title_shape.text = "要点列表"
tf = body_shape.text_frame
tf.text = "第一个要点"

# 添加更多要点
p = tf.add_paragraph()
p.text = "第二个要点"
p.level = 0

p = tf.add_paragraph()
p.text = "第三个要点"
p.level = 1  # 次级要点

prs.save("with_new_slides.pptx")

步骤 4: 添加图片

from pptx import Presentation
from pptx.util import Inches

prs = Presentation()
blank_slide_layout = prs.slide_layouts[6]  # 空白布局
slide = prs.slides.add_slide(blank_slide_layout)

# 添加图片(指定位置和大小)
left = Inches(1)
top = Inches(1.5)
width = Inches(5)
height = Inches(3)

pic = slide.shapes.add_picture('chart.png', left, top, width, height)

prs.save("with_image.pptx")

步骤 5: 添加表格

from pptx import Presentation
from pptx.util import Inches

prs = Presentation()
title_slide_layout = prs.slide_layouts[5]  # 标题+内容
slide = prs.slides.add_slide(title_slide_layout)
shapes = slide.shapes

shapes.title.text = "销售数据"

# 添加表格
rows = 4
cols = 3
left = Inches(2)
top = Inches(2)
width = Inches(6)
height = Inches(3)

table = shapes.add_table(rows, cols, left, top, width, height).table

# 设置表头
table.cell(0, 0).text = "产品"
table.cell(0, 1).text = "数量"
table.cell(0, 2).text = "收入"

# 填充数据
table.cell(1, 0).text = "产品A"
table.cell(1, 1).text = "100"
table.cell(1, 2).text = "¥5000"

table.cell(2, 0).text = "产品B"
table.cell(2, 1).text = "150"
table.cell(2, 2).text = "¥12000"

prs.save("with_table.pptx")

步骤 6: 批量处理

from pptx import Presentation
import os

# 批量更新多个演示文稿
template = Presentation("template.pptx")

branches = ["北京", "上海", "广州", "深圳"]
data = {
    "北京": {"sales": 1250000, "growth": "23%"},
    "上海": {"sales": 1100000, "growth": "18%"},
    # ...
}

for branch in branches:
    prs = Presentation("template.pptx")
    
    # 更新标题页
    title_slide = prs.slides[0]
    title_slide.shapes.title.text = f"{branch}分公司 Q1 报告"
    
    # 更新数据页
    data_slide = prs.slides[1]
    for shape in data_slide.shapes:
        if hasattr(shape, "text"):
            shape.text = shape.text.replace("{branch}", branch)
            shape.text = shape.text.replace("{sales}", str(data[branch]["sales"]))
            shape.text = shape.text.replace("{growth}", data[branch]["growth"])
    
    prs.save(f"{branch}_report.pptx")
    print(f"已生成: {branch}_report.pptx")

工作流 3: 分析和提取内容

方法 1: Markitdown(快速提取文本)

适用场景: 只需要读取演示文稿的文字内容

# 安装
pip install markitdown

# 转换为 Markdown
python -m markitdown presentation.pptx > content.md

输出示例:

# 幻灯片 1

## 2024 年度总结

销售部 | 2024-01

---

# 幻灯片 2

## 主要成果

- 营收增长 23%
- 新客户 87 个
- 市场份额 +5%

方法 2: OOXML 解析(深度访问)

适用场景: 需要访问备注、评论、主题、动画等高级元素

步骤 1: 解包 PPTX
# PPTX 本质是 ZIP 文件
python ooxml/scripts/unpack.py presentation.pptx output_dir/
步骤 2: 理解文件结构
output_dir/
├── ppt/
│   ├── presentation.xml          # 主演示文稿元数据
│   ├── slides/
│   │   ├── slide1.xml            # 第 1 张幻灯片
│   │   ├── slide2.xml            # 第 2 张幻灯片
│   │   └── ...
│   ├── notesSlides/
│   │   ├── notesSlide1.xml       # 第 1 张的备注
│   │   └── ...
│   ├── comments/
│   │   └── modernComment_*.xml   # 评论
│   ├── slideLayouts/             # 布局模板
│   ├── slideMasters/             # 母版
│   ├── theme/
│   │   └── theme1.xml            # 主题(颜色、字体)
│   └── media/                    # 图片、视频
├── docProps/
│   ├── core.xml                  # 元数据
│   └── app.xml
└── [Content_Types].xml
步骤 3: 提取特定信息

提取备注:

# 查看第 1 张幻灯片的备注
cat output_dir/ppt/notesSlides/notesSlide1.xml | grep -o '<a:t>.*</a:t>'

提取主题颜色:

import xml.etree.ElementTree as ET

tree = ET.parse('output_dir/ppt/theme/theme1.xml')
root = tree.getroot()

# 查找颜色方案
for elem in root.iter():
    if 'clrScheme' in elem.tag:
        for color in elem:
            print(color.tag, color.attrib)

提取评论:

# 查看所有评论文件
cat output_dir/ppt/comments/*.xml
步骤 4: 修改 XML 并重新打包
# 1. 修改 XML 文件(使用文本编辑器或脚本)
# 2. 重新打包为 ZIP
cd output_dir
zip -r ../modified.pptx *

# 3. 重命名为 .pptx
mv ../modified.zip ../modified.pptx

🎨 设计指南

视觉层次原则

  1. 大小对比

    • 标题: 36-48pt
    • 副标题: 28-32pt
    • 正文: 18-24pt
  2. 粗细对比

    • 标题: Bold
    • 副标题: Semi-bold
    • 正文: Regular
  3. 颜色对比

    • 标题: 深色(高对比)
    • 正文: 中性色
    • 强调: 品牌色/强调色

布局最佳实践

❌ 避免:

  • 垂直堆叠图表和大段文字(可读性差)
  • 过多的项目符号(超过 7 个)
  • 文字过小(小于 16pt)
  • 对比度不足(浅色文字 + 浅色背景)

✅ 推荐:

  • 双列布局(文字 + 可视化)
  • 一张幻灯片一个核心观点
  • 大量留白
  • 使用图标和图表代替纯文字

视觉细节选项

几何图案:

  • 对角线分隔而非水平线
  • 非对称列宽(30/70, 40/60)
  • 圆形/六边形图片框架
  • 三角形强调元素

边框处理:

  • 单侧粗边框(10-20pt)
  • 双线边框(对比色)
  • L 型边框(仅顶部+左侧)
  • 标题下划线强调(3-5pt)

排版处理:

  • 极端大小对比(72pt 标题 vs 11pt 正文)
  • 全大写标题 + 宽字符间距
  • 等宽字体用于数据/技术内容
  • 轮廓文字用于强调

📋 HTML 模板库

模板 1: 标题页

<div class="slide" style="background: linear-gradient(135deg, #667C6F 0%, #BFD5BE 100%); text-align: center;">
  <div style="padding-top: 180px;">
    <h1 style="color: white; font-size: 48pt; margin-bottom: 10px;">演示标题</h1>
    <p style="color: rgba(255,255,255,0.9); font-size: 18pt;">副标题或日期</p>
  </div>
</div>

模板 2: 双列(文字 + 图表)

<div class="slide">
  <h1 style="color: #1C2833; border-bottom: 4px solid #BF9A4A; padding-bottom: 10px;">数据洞察</h1>
  <div style="display: flex; gap: 30px; margin-top: 30px;">
    <div style="flex: 0 0 40%;">
      <h2 style="color: #2E4053;">关键发现</h2>
      <ul style="font-size: 20pt; line-height: 1.8;">
        <li>增长 23%</li>
        <li>新客户 87</li>
        <li>复购率 65%</li>
      </ul>
    </div>
    <div style="flex: 0 0 60%;">
      <img src="chart.png" style="width: 100%; border-radius: 8px;">
    </div>
  </div>
</div>

模板 3: 数据卡片

<div class="slide">
  <h1>关键指标</h1>
  <div style="display: flex; gap: 20px; margin-top: 40px;">
    <div style="flex: 1; background: #E8F4F8; padding: 30px; text-align: center; border-radius: 8px;">
      <h2 style="font-size: 60pt; color: #1C2833; margin: 0;">¥125M</h2>
      <p style="color: #2E4053; font-size: 18pt;">年度收入</p>
    </div>
    <div style="flex: 1; background: #FFF4E8; padding: 30px; text-align: center; border-radius: 8px;">
      <h2 style="font-size: 60pt; color: #C15937; margin: 0;">+23%</h2>
      <p style="color: #997929; font-size: 18pt;">增长率</p>
    </div>
    <div style="flex: 1; background: #E8F8E8; padding: 30px; text-align: center; border-radius: 8px;">
      <h2 style="font-size: 60pt; color: #40695B; margin: 0;">87</h2>
      <p style="color: #87A96B; font-size: 18pt;">新客户</p>
    </div>
  </div>
</div>

模板 4: 时间线

<div class="slide">
  <h1>项目里程碑</h1>
  <div style="margin-top: 40px;">
    <div style="border-left: 4px solid #BF9A4A; padding-left: 30px; margin-bottom: 30px;">
      <h3 style="color: #BF9A4A; margin: 0;">2024 Q1</h3>
      <p style="font-size: 18pt; margin: 5px 0;">启动项目,完成需求分析</p>
    </div>
    <div style="border-left: 4px solid #C15937; padding-left: 30px; margin-bottom: 30px;">
      <h3 style="color: #C15937; margin: 0;">2024 Q2</h3>
      <p style="font-size: 18pt; margin: 5px 0;">开发阶段,完成 MVP</p>
    </div>
    <div style="border-left: 4px solid #40695B; padding-left: 30px;">
      <h3 style="color: #40695B; margin: 0;">2024 Q3</h3>
      <p style="font-size: 18pt; margin: 5px 0;">测试上线,收集反馈</p>
    </div>
  </div>
</div>

🎯 最佳实践

1. 文件命名规范

✅ 好的命名:
- 2024_Q1_Sales_Report.pptx
- Product_Launch_Presentation_v2.pptx

❌ 避免:
- 新建演示文稿.pptx
- 123.pptx
- final_final_FINAL.pptx

2. 性能优化

图片优化:

from PIL import Image

# 压缩图片再插入 PPT
img = Image.open("large_image.png")
img = img.resize((1920, 1080), Image.LANCZOS)
img.save("optimized.png", quality=85, optimize=True)

批量处理时的内存管理:

import gc

for i in range(100):
    prs = Presentation("template.pptx")
    # ... 处理 ...
    prs.save(f"output_{i}.pptx")
    
    # 释放内存
    del prs
    gc.collect()

3. 版本控制

对于重要演示文稿,使用版本号:

from datetime import datetime

version = datetime.now().strftime("%Y%m%d_%H%M")
prs.save(f"Presentation_{version}.pptx")

⚠️ 常见问题

问题 1: HTML 转 PPTX 后布局不准确

原因: 复杂的 CSS 可能无法完全转换

解决方案:

  • 使用简单的 flexbox 布局
  • 避免复杂的 CSS 选择器
  • 使用内联样式而非外部 CSS

问题 2: 中文字体显示异常

原因: 字体嵌入问题

解决方案:

from pptx.util import Pt
from pptx.enum.text import PP_ALIGN

# 明确指定字体
run = text_frame.paragraphs[0].runs[0]
run.font.name = "Microsoft YaHei"  # 微软雅黑
run.font.size = Pt(24)

问题 3: 图片分辨率模糊

解决方案: 使用高分辨率图片(至少 1920x1080)

# 添加图片时保持原始分辨率
pic = slide.shapes.add_picture('high_res.png', left, top, width, height)

问题 4: 无法访问备注和评论

解决方案: 使用 OOXML 解析工作流(见工作流 3)


🔗 参考资源

官方文档

  • python-pptx 文档
  • Office Open XML 规范

设计灵感

  • Slidesgo - 免费 PPT 模板
  • Canva - 演示设计工具
  • Beautiful.ai - AI 演示设计

📝 总结

PowerPoint 演示文稿处理技能提供了完整的 PPTX 操作方案:

✅ HTML2PPTX - 创建新演示,完全控制设计
✅ python-pptx - 编辑现有演示,批量处理
✅ Markitdown - 快速提取文本内容
✅ OOXML 解析 - 深度访问备注、评论、主题
✅ 设计系统 - 18 种配色 + 视觉细节指南
✅ HTML 模板 - 常用幻灯片布局

根据任务选择合适的工作流,遵循设计原则,可以高效创建专业的演示文稿。


📖 返回 PowerPoint 演示文稿处理概览

🏠 返回 技能列表

Prev
📋 概览