Skill detail
pptx-manipulation
Creates, edits, and manipulates .pptx presentations using python-pptx with text, shapes, images, charts, and tables.
Inspect before use
Read the source instructions and check the requirements before you install this skill.
SKILL.md
The saved excerpt is a snapshot from when this skill was listed. The external source remains the complete and most current version.
---
# ═══════════════════════════════════════════════════════════════════════════════
# 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
```python
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
```python
# 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
```python
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
```python
# 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
```python
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
```python
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
```python
# 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)
)
```
### Read the full source on GitHub (opens external page)