Pptx Official Toolkit
Battle-tested skill for skill, time, pptx, file. Includes structured workflows, validation checks, and reusable patterns for document processing.
PPTX Official Toolkit
A standardized skill for PowerPoint file operations following best practices. Covers reading PPTX content with markitdown, creating presentations with python-pptx, editing existing slides, and converting between formats.
When to Use This Skill
Choose this skill when:
- Reading and analyzing PowerPoint presentation content
- Editing existing PPTX files (updating text, replacing images)
- Creating presentations following corporate templates
- Extracting structured data from slide decks
- Batch-processing multiple presentations
Consider alternatives when:
- Creating complex data visualizations → use a charting library
- Building interactive presentations → use reveal.js
- Working with Keynote files → use a Keynote tool
- Creating slide decks from Markdown → use Marp or Slidev
Quick Start
# Read PPTX content python -m markitdown presentation.pptx # Or use python-pptx for structured extraction python3 -c " from pptx import Presentation prs = Presentation('presentation.pptx') for i, slide in enumerate(prs.slides, 1): print(f'--- Slide {i} ---') for shape in slide.shapes: if shape.has_text_frame: print(shape.text_frame.text) "
# Edit existing presentation from pptx import Presentation prs = Presentation('existing.pptx') # Update title on first slide first_slide = prs.slides[0] first_slide.shapes.title.text = 'Updated Title' # Update specific placeholder text for shape in first_slide.shapes: if shape.has_text_frame: for paragraph in shape.text_frame.paragraphs: for run in paragraph.runs: if 'OLD_TEXT' in run.text: run.text = run.text.replace('OLD_TEXT', 'NEW_TEXT') prs.save('updated.pptx')
Core Concepts
PPTX Operations
| Operation | Approach | Tool |
|---|---|---|
| Read content | Extract text from shapes | markitdown or python-pptx |
| Edit text | Modify run text preserving format | python-pptx runs |
| Add slides | Copy layout and add content | python-pptx layouts |
| Replace images | Remove old, add new shape | python-pptx pictures |
| Add charts | ChartData + add_chart | python-pptx charts |
| Convert to PDF | Headless rendering | libreoffice --convert-to pdf |
| Extract images | Read shape image blobs | python-pptx shape.image |
Slide Template Usage
from pptx import Presentation from pptx.util import Inches def create_from_template(template_path: str, slides_data: list[dict], output_path: str): prs = Presentation(template_path) for slide_info in slides_data: layout_name = slide_info.get('layout', 'Title and Content') layout = next( (l for l in prs.slide_layouts if l.name == layout_name), prs.slide_layouts[1] # Fallback ) slide = prs.slides.add_slide(layout) if 'title' in slide_info and slide.shapes.title: slide.shapes.title.text = slide_info['title'] if 'body' in slide_info: for ph in slide.placeholders: if ph.placeholder_format.idx == 1: # Body placeholder tf = ph.text_frame tf.text = slide_info['body'][0] if slide_info['body'] else '' for line in slide_info['body'][1:]: p = tf.add_paragraph() p.text = line if 'image' in slide_info: slide.shapes.add_picture( slide_info['image'], Inches(5), Inches(1.5), Inches(4) ) prs.save(output_path)
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
readTool | string | 'markitdown' | Reading: markitdown or python-pptx |
templatePath | string | '' | Corporate template PPTX |
defaultLayout | string | 'Title and Content' | Default slide layout name |
imageMaxWidth | number | 4 | Max image width in inches |
preserveFormatting | boolean | true | Preserve formatting when editing text |
Best Practices
-
Use markitdown for quick content reading, python-pptx for structured editing — markitdown converts PPTX to readable text quickly. python-pptx gives programmatic access to every element for precise modifications.
-
Preserve formatting by editing runs, not replacing text frames — Replacing
text_frame.textloses all formatting. Iterate through runs and modifyrun.textto keep bold, italic, colors, and fonts intact. -
Use corporate templates to inherit branding automatically — Loading a branded template ensures consistent colors, fonts, and layouts without manual styling code.
-
Convert to PDF for final distribution —
libreoffice --headless --convert-to pdfproduces reliable PDF output from PPTX. This eliminates compatibility issues when recipients use different PowerPoint versions. -
Enumerate layouts and placeholders before using them — Different templates define different layouts. Print available layouts and their placeholder indices before building slides to avoid errors.
Common Issues
Placeholder index doesn't exist in layout — Different layouts have different placeholder indices. Use for ph in slide.placeholders: print(ph.placeholder_format.idx, ph.name) to discover available placeholders.
Formatting lost when setting text — Setting placeholder.text = 'new text' replaces all runs with a single unformatted run. Instead, modify existing runs or copy formatting from the old run before replacing.
Generated PPTX looks different in Google Slides vs PowerPoint — Google Slides has limited OOXML support. Custom fonts, animations, and complex charts may render differently. Test in your target platform.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Full-Stack Code Reviewer
Comprehensive code review skill that checks for security vulnerabilities, performance issues, accessibility, and best practices across frontend and backend code.
Test Suite Generator
Generates comprehensive test suites with unit tests, integration tests, and edge cases. Supports Jest, Vitest, Pytest, and Go testing.
Pro Architecture Workspace
Battle-tested skill for architectural, decision, making, framework. Includes structured workflows, validation checks, and reusable patterns for development.