跳到主内容
智客 ZICQ

技能库 智客分类:文档办公 pptx-manipulation

Pptx Manipulation

> 翻译:

4907 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

> 翻译:

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:PPTX Manipulation Skill、Overview、How to Use、Domain Knowledge、python-pptx Fundamentals、Create new presentation。 其中含规范建议的小节:边界情况。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

>

PPTX Manipulation SkillOverviewHow to UseDomain Knowledgepython-pptx FundamentalsCreate new presentationOr open existingPresentation StructureSlide LayoutsCommon layout indices (may vary by template)Add slide with layoutAdding Content

· 许可:MIT

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
pptx-manipulation
description
>
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「pptx-manipulation」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-ace0dca40b666c36-Pptx-%E6%93%8D%E7%BA%B5.html
请存为 .cursor/skills/pptx-manipulation/SKILL.md 或 .claude/skills/pptx-manipulation/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/claude-office-skills/skills' --list

npx skills add 'https://github.com/claude-office-skills/skills' --skill 'pptx-manipulation'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版

═══════════════════════════════════════════════════════════════════════════════

CLAUDE OFFICE SKILL - Enhanced Metadata v2.0

═══════════════════════════════════════════════════════════════════════════════

Basic Information

name: pptx-manipulation description: ">" version: "1.0" author: claude-office-skills license: MIT

Categorization

category: presentation tags:

  • pptx
  • powerpoint
  • manipulation
  • editing department: All

AI Model Compatibility

models: recommended: - claude-sonnet-4 - claude-opus-4 compatible: - claude-3-5-sonnet - gpt-4 - gpt-4o

MCP Tools Integration

mcp: server: office-mcp tools: - create_pptx - extract_from_pptx - add_slide - update_slide

Skill Capabilities

capabilities:

  • presentation_creation
  • slide_editing

Language Support

languages:

  • en
  • zh

PPTX Manipulation Skill

Overview

This skill enables programmatic creation, editing, and manipulation of Microsoft PowerPoint (.pptx) presentations using the python-pptx library. Create professional slides with text, shapes, images, charts, and tables without manual editing.

How to Use

  1. Describe the presentation you want to create or modify
  2. Provide content, data, or images to include
  3. I'll generate python-pptx code and execute it

Example prompts:

  • "Create a 10-slide pitch deck from this outline"
  • "Add a chart to slide 3 with this data"
  • "Extract all text from this presentation"
  • "Generate slides from this markdown content"

Domain Knowledge

python-pptx Fundamentals

from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import PP_ALIGN

# Create new presentation
prs = Presentation()

# Or open existing
prs = Presentation('existing.pptx')

Presentation Structure

Presentation
├── slide_layouts (predefined layouts)
├── slides (individual slides)
│   ├── shapes (text, images, charts)
│   │   ├── text_frame (paragraphs)
│   │   └── table (rows, cells)
│   └── placeholders (title, content)
└── slide_masters (templates)

Slide Layouts

# Common layout indices (may vary by template)
TITLE_SLIDE = 0
TITLE_CONTENT = 1
SECTION_HEADER = 2
TWO_CONTENT = 3
COMPARISON = 4
TITLE_ONLY = 5
BLANK = 6

# Add slide with layout
slide_layout = prs.slide_layouts[TITLE_CONTENT]
slide = prs.slides.add_slide(slide_layout)

Adding Content

Title Slide

slide_layout = prs.slide_layouts[0]  # Title slide
slide = prs.slides.add_slide(slide_layout)

title = slide.shapes.title
subtitle = slide.placeholders[1]

title.text = "Quarterly Report"
subtitle.text = "Q4 2024 Performance Review"

Text Content

# Using placeholder
body = slide.placeholders[1]
tf = body.text_frame
tf.text = "First bullet point"

# Add more paragraphs
p = tf.add_paragraph()
p.text = "Second bullet point"
p.level = 0

p = tf.add_paragraph()
p.text = "Sub-bullet"
p.level = 1

Text Box

from pptx.util import Inches, Pt

left = Inches(1)
top = Inches(2)
width = Inches(4)
height = Inches(1)

txBox = slide.shapes.add_textbox(left, top, width, height)
tf = txBox.text_frame

p = tf.paragraphs[0]
p.text = "Custom text box"
p.font.bold = True
p.font.size = Pt(18)

Shapes

from pptx.enum.shapes import MSO_SHAPE

# Rectangle
shape = slide.shapes.add_shape(
    MSO_SHAPE.RECTANGLE,
    Inches(1), Inches(2),  # left, top
    Inches(3), Inches(1.5) # width, height
)
shape.text = "Rectangle with text"

# Common shapes:
# MSO_SHAPE.RECTANGLE, ROUNDED_RECTANGLE
# MSO_SHAPE.OVAL, CHEVRON, ARROW_RIGHT
# MSO_SHAPE.CALLOUT_ROUNDED_RECTANGLE

Images

# Add image
slide.shapes.add_picture(
    'image.png',
    Inches(1), Inches(2),  # position
    width=Inches(4)        # auto height
)

# Or specify both dimensions
slide.shapes.add_picture(
    'logo.png',
    Inches(8), Inches(0.5),
    Inches(1.5), Inches(0.75)
)

Tables

# Create table
rows, cols = 4, 3
left = Inches(1)
top = Inches(2)
width = Inches(8)
height = Inches(2)

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

# Set column widths
table.columns[0].width = Inches(2)
table.columns[1].width = Inches(3)
table.columns[2].width = Inches(3)

# Add headers
headers = ['Product', 'Q3 Sales', 'Q4 Sales']
for i, header in enumerate(headers):
    cell = table.cell(0, i)
    cell.text = header
    cell.text_frame.paragraphs[0].font.bold = True

# Add data
data = [
    ['Widget A', '$10,000', '$12,500'],
    ['Widget B', '$8,000', '$9,200'],
    ['Widget C', '$15,000', '$18,000'],
]
for row_idx, row_data in enumerate(data, 1):
    for col_idx, value in enumerate(row_data):
        table.cell(row_idx, col_idx).text = value

Charts

from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE

# Chart data
chart_data = CategoryChartData()
chart_data.categories = ['Q1', 'Q2', 'Q3', 'Q4']
chart_data.add_series('Sales', (19.2, 21.4, 16.7, 23.8))
chart_data.add_series('Expenses', (12.1, 15.3, 14.2, 18.1))

# Add chart
x, y, cx, cy = Inches(1), Inches(2), Inches(8), Inches(4)
chart = slide.shapes.add_chart(
    XL_CHART_TYPE.COLUMN_CLUSTERED,
    x, y, cx, cy, chart_data
).chart

# Customize
chart.has_legend = True
chart.legend.include_in_layout = False

Formatting

Text Formatting

from pptx.dml.color import RGBColor

run = p.runs[0]
run.font.name = 'Arial'
run.font.size = Pt(24)
run.font.bold = True
run.font.italic = True
run.font.color.rgb = RGBColor(0x00, 0x66, 0xCC)

Shape Fill & Line

from pptx.dml.color import RGBColor

shape.fill.solid()
shape.fill.fore_color.rgb = RGBColor(0x00, 0x80, 0x00)

shape.line.color.rgb = RGBColor(0x00, 0x00, 0x00)
shape.line.width = Pt(2)

Paragraph Alignment

from pptx.enum.text import PP_ALIGN

p.alignment = PP_ALIGN.CENTER  # LEFT, RIGHT, JUSTIFY

Best Practices

  1. Use Templates: Start with a .pptx template for consistent branding
  2. Layout First: Plan slide structure before coding
  3. Reuse Slide Masters: Maintain consistency across presentations
  4. Optimize Images: Compress images before adding
  5. Test Output: Always verify generated presentations

Common Patterns

Slide Deck Generator

def create_deck(title, slides_content):
    prs = Presentation()
    
    # Title slide
    slide = prs.slides.add_slide(prs.slide_layouts[0])
    slide.shapes.title.text = title
    
    # Content slides
    for slide_data in slides_content:
        slide = prs.slides.add_slide(prs.slide_layouts[1])
        slide.shapes.title.text = slide_data['title']
        
        body = slide.placeholders[1]
        tf = body.text_frame
        for i, point in enumerate(slide_data['points']):
            if i == 0:
                tf.text = point
            else:
                p = tf.add_paragraph()
                p.text = point
    
    return prs

Data-Driven Charts

def add_bar_chart(slide, title, categories, values):
    from pptx.chart.data import CategoryChartData
    from pptx.enum.chart import XL_CHART_TYPE
    
    chart_data = CategoryChartData()
    chart_data.categories = categories
    chart_data.add_series('Values', values)
    
    chart = slide.shapes.add_chart(
        XL_CHART_TYPE.BAR_CLUSTERED,
        Inches(1), Inches(2),
        Inches(8), Inches(4),
        chart_data
    ).chart
    
    chart.chart_title.text_frame.text = title
    return chart

Examples

Example 1: Create a Pitch Deck

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

prs = Presentation()

# Slide 1: Title
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "StartupX"
slide.placeholders[1].text = "Revolutionizing Document Processing"

# Slide 2: Problem
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "The Problem"
body = slide.placeholders[1].text_frame
body.text = "Manual document processing costs businesses $1T annually"
p = body.add_paragraph()
p.text = "Average worker spends 20% of time on document tasks"
p.level = 1

# Slide 3: Solution
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Our Solution"
body = slide.placeholders[1].text_frame
body.text = "AI-powered document automation"
body.add_paragraph().text = "90% faster processing"
body.add_paragraph().text = "99.5% accuracy"
body.add_paragraph().text = "Works with existing tools"

# Slide 4: Market
slide = prs.slides.add_slide(prs.slide_layouts[5])  # Title only
slide.shapes.title.text = "Market Opportunity: $50B by 2028"

# Add chart
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE

data = CategoryChartData()
data.categories = ['2024', '2025', '2026', '2027', '2028']
data.add_series('Market Size ($B)', [30, 35, 40, 45, 50])

slide.shapes.add_chart(
    XL_CHART_TYPE.LINE,
    Inches(1), Inches(1.5),
    Inches(8), Inches(5),
    data
)

prs.save('pitch_deck.pptx')

Example 2: Report with Data Table

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

prs = Presentation()

# Title slide
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Sales Performance Report"
slide.placeholders[1].text = "Q4 2024"

# Data slide
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Regional Performance"

# Create table
table = slide.shapes.add_table(5, 4, Inches(0.5), Inches(1.5), Inches(9), Inches(4)).table

# Headers
headers = ['Region', 'Revenue', 'Growth', 'Target']
for i, h in enumerate(headers):
    table.cell(0, i).text = h
    table.cell(0, i).text_frame.paragraphs[0].font.bold = True

# Data
data = [
    ['North America', '$5.2M', '+15%', 'Met'],
    ['Europe', '$3.8M', '+12%', 'Met'],
    ['Asia Pacific', '$2.9M', '+28%', 'Exceeded'],
    ['Latin America', '$1.1M', '+8%', 'Below'],
]
for row_idx, row_data in enumerate(data, 1):
    for col_idx, value in enumerate(row_data):
        table.cell(row_idx, col_idx).text = value

prs.save('sales_report.pptx')

Limitations

  • Cannot render complex animations
  • Limited SmartArt support
  • No video embedding via API
  • Master slide editing is complex
  • Chart types limited to standard Office charts

Installation

pip install python-pptx

Resources

相关技能

文档办公

Ontology

为结构化的代理内存和可堆肥技能所打入的知识图. 在创建/征服实体(Person, project, Task, Evention, Document)时使用,链接相关对象,强制约束,规划多步动作作为图变,或技能需要共享状态时使用. 触发到"记住","我知道什么","链接X到Y",…

文档办公

Nano Pdf

使用纳米-pdf CLI编辑带有自然语言指令的PDF.

文档办公

Word / DOCX

创建,检查,并编辑有可靠样式的Microsoft Word文档和DOCX文件,编号,跟踪更改,表格,章节,并进行相容性检查. 当 (1) 任务涉及 Word 或 ".docx " 时使用; (2) 文件包括跟踪的更改,评论,字段,表格,模板,或页面布局限制; (3) 文档必须在不…

文档办公

Api Gateway

通过 Maton 网关调用第三方 API, 它为用户已经连接的应用程序注入证书 。 当用户命名一个连接的应用程序和其中的具体行动时使用此技能——读取一个邮箱,查询一个CMM,归档一个问题,更新一个电子表格,通过一个连接的搜索或刮取提供者运行一个查询. 每一次通话都到用户连接的应用…