by @anthropic
A comprehensive presentation skill using python-pptx. Create professional slide decks with custom layouts, color themes, tables, images, speaker notes, and bold design. Read and edit existing .pptx files with content modification and styling changes.
Use this skill any time a .pptx file is involved — as input, output, or both. This includes creating slide decks, pitch decks, presentations, reading/parsing .pptx files, editing/modifying existing presentations, and working with templates, layouts, speaker notes, or comments.
| Task | Approach |
|---|---|
| Read/analyze content | python-pptx to extract text and structure |
| Edit or create from template | python-pptx — load and modify |
| Create from scratch | python-pptx — build slides programmatically |
from pptx import Presentation
prs = Presentation('presentation.pptx')
for i, slide in enumerate(prs.slides):
print(f"--- Slide {i+1} ---")
for shape in slide.shapes:
if hasattr(shape, "text"):
print(shape.text)
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
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
# Title slide
slide_layout = prs.slide_layouts[6] # Blank layout
slide = prs.slides.add_slide(slide_layout)
# Add background
background = slide.background
fill = background.fill
fill.solid()
fill.fore_color.rgb = RGBColor(0x1E, 0x27, 0x61)
# Add title text
from pptx.util import Inches, Pt
txBox = slide.shapes.add_textbox(Inches(1), Inches(2), Inches(11), Inches(2))
tf = txBox.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = "Presentation Title"
p.font.size = Pt(44)
p.font.bold = True
p.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
p.alignment = PP_ALIGN.CENTER
# Subtitle
p2 = tf.add_paragraph()
p2.text = "Subtitle or description"
p2.font.size = Pt(20)
p2.font.color.rgb = RGBColor(0xCA, 0xDC, 0xFC)
p2.alignment = PP_ALIGN.CENTER
prs.save('presentation.pptx')
# Two-column layout
slide = prs.slides.add_slide(prs.slide_layouts[6])
# L...