P

Pptx Official Toolkit

Battle-tested skill for skill, time, pptx, file. Includes structured workflows, validation checks, and reusable patterns for document processing.

SkillClipticsdocument processingv1.0.0MIT
0 views0 copies

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

OperationApproachTool
Read contentExtract text from shapesmarkitdown or python-pptx
Edit textModify run text preserving formatpython-pptx runs
Add slidesCopy layout and add contentpython-pptx layouts
Replace imagesRemove old, add new shapepython-pptx pictures
Add chartsChartData + add_chartpython-pptx charts
Convert to PDFHeadless renderinglibreoffice --convert-to pdf
Extract imagesRead shape image blobspython-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

ParameterTypeDefaultDescription
readToolstring'markitdown'Reading: markitdown or python-pptx
templatePathstring''Corporate template PPTX
defaultLayoutstring'Title and Content'Default slide layout name
imageMaxWidthnumber4Max image width in inches
preserveFormattingbooleantruePreserve formatting when editing text

Best Practices

  1. 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.

  2. Preserve formatting by editing runs, not replacing text frames — Replacing text_frame.text loses all formatting. Iterate through runs and modify run.text to keep bold, italic, colors, and fonts intact.

  3. Use corporate templates to inherit branding automatically — Loading a branded template ensures consistent colors, fonts, and layouts without manual styling code.

  4. Convert to PDF for final distributionlibreoffice --headless --convert-to pdf produces reliable PDF output from PPTX. This eliminates compatibility issues when recipients use different PowerPoint versions.

  5. 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.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates