PPTX Creation, Editing, and Analysis
Overview
Users may request the creation, editing, or content analysis of .pptx files. A .pptx file is essentially a ZIP archive containing XML files and other resources, which can be read and edited. Different tools and workflows are available depending on the task.
Content Reading and Analysis
Text Extraction
If you only need to read the text content of a presentation, convert the document to markdown:
bash
# Convert document to markdown
python -m markitdown path-to-file.pptx
Raw XML Access
Raw XML access is required for comments, presenter notes, slide layouts, animations, design elements, and complex formatting. These features require unpacking the presentation to read the raw XML content.
Unpacking Files
python ooxml/scripts/unpack.py <office_file> <output_dir>
Note: The unpack.py script is located at
skills/pptx/ooxml/scripts/unpack.py
relative to the project root. If the script does not exist at this path, use
to search for it.
Main File Structure
- - Main presentation metadata and slide references
- - Individual slide content (slide1.xml, slide2.xml, etc.)
ppt/notesSlides/notesSlide{N}.xml
- Presenter notes for each slide
ppt/comments/modernComment_*.xml
- Comments on specific slides
- - Slide layout templates
- - Master slide templates
- - Theme and style information
- - Images and other media files
Typography and Color Extraction
If there is a design example to emulate: First analyze the presentation's typography and colors using the following methods:
- Read the theme file: Check colors () and fonts () in
- Sample slide content: Examine actual font usage () and colors in
- Search for patterns: Use grep to search all XML files for colors (, ) and font references
Create a New PowerPoint Presentation Without a Template
When creating a new PowerPoint presentation from scratch, use the html2pptx workflow to convert HTML slides to PowerPoint with precise positioning.
Design Principles
Important: Before creating a presentation, analyze the content and select appropriate design elements:
- Consider the topic: What is this presentation about? What tone, industry, or atmosphere does it suggest?
- Check branding: If the user mentions a company/organization, consider its brand colors and identity
- Match the palette to the content: Select colors that reflect the topic
- Explain the approach: Explain design choices before writing code
Requirements:
- ✅ Explain the content-based design approach before writing code
- ✅ Use only web-safe fonts: Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact
- ✅ Create a clear visual hierarchy with size, weight, and color
- ✅ Ensure readability: Strong contrast, appropriately sized text, clean placement
- ✅ Maintain consistency: Repeat patterns, spacing, and visual language across slides
Color Palette Selection
Choose colors creatively:
- Think beyond defaults: What colors really suit this specific topic? Avoid automatic selections
- Consider multiple angles: Topic, industry, atmosphere, energy level, audience, brand identity (if mentioned)
- Be adventurous: Try unexpected combinations - a healthcare presentation doesn't have to be green, and a financial one doesn't have to be navy blue
- Build a palette: Select 3-5 colors that work together (primary + supporting + accent)
- Ensure contrast: Text must be clearly readable against the background
Color Palette Examples (use to stimulate creativity - choose one, adapt it, or create your own):
- Classic Blue: Deep Navy (#1C2833), Slate Gray (#2E4053), Silver (#AAB7B8), Off-White (#F4F6F6)
- Teal & Coral: Teal (#5EA8A7), Deep Teal (#277884), Coral (#FE4447), White (#FFFFFF)
- Bold Red: Red (#C0392B), Bright Red (#E74C3C), Orange (#F39C12), Yellow (#F1C40F), Green (#2ECC71)
- Warm Blush: Mauve (#A49393), Blush (#EED6D3), Rose (#E8B4B8), Cream (#FAF7F2)
- Burgundy Luxury: Burgundy (#5D1D2E), Crimson (#951233), Rust (#C15937), Gold (#997929)
Visual Detail Options
Geometric Patterns:
- Diagonal section dividers instead of horizontal
- Asymmetric column widths (30/70, 40/60, 25/75)
- Text headers rotated at 90° or 270°
- Circular/hexagonal frames for images
- Triangle accent shapes at corners
- Overlapping shapes for depth
Border & Frame Treatments:
- Thick solid-color border on only one side (10-20pt)
- Double-line border with contrasting colors
- Corner brackets instead of full frames
- L-shaped borders (top+left or bottom+right)
- Underline accent below headers (3-5pt thickness)
Typography Treatments:
- Extreme size contrast (72pt headline vs 11pt body)
- All-caps headers with wide letter spacing
- Oversized display-type numbered sections
- Monospace (Courier New) for data/statistical/technical content
- Condensed font (Arial Narrow) for dense information
- Outline text for emphasis
Layout Tips
When creating slides with charts or tables:
- 2-column layout (recommended): Use a full-width header, with two columns below it - one for text/bullet points and the other for featured content. This provides better balance and makes charts/tables more readable. Use flexbox with unequal column widths (e.g., 40%/60% split) to optimize space for each content type
- Full-slide layout: Display featured content (chart/table) across the entire slide for maximum impact and readability
- Don't stack vertically: Avoid placing charts/tables in a single column below text - this causes readability and layout issues
Workflow
- Required - Read the entire file: Read from start to finish. Do not set scope limits when reading this file. Read the entire file for detailed syntax, important formatting rules, and best practices before proceeding with presentation creation.
- Create HTML files for each slide with appropriate dimensions (e.g., 720pt × 405pt for 16:9)
- Use , -, , for all text content
- Use for areas where charts/tables will be added (rendered with a gray background for visibility)
- Important: First use Sharp to rasterize gradients and icons into PNG images, then reference them in HTML
- Layout: Use full-slide or 2-column layouts for slides containing charts/tables/images for better readability
- Create and execute a JavaScript file that uses the library to convert HTML slides to PowerPoint and save the presentation
- Use the function to process each HTML file
- Use the PptxGenJS API to add charts and tables to placeholder areas
- Use to save the presentation
- Visual Validation: Generate thumbnails to check for layout issues
- Create a thumbnail grid:
python scripts/thumbnail.py output.pptx workspace/thumbnails --cols 4
- Read the thumbnail images and carefully check for:
- Text clipping: Text cut off by header bars, shapes, or slide edges
- Text overlapping: Text overlapping with other text or shapes
- Positioning issues: Content too close to slide boundaries or other elements
- Contrast issues: Insufficient contrast between text and background
- If issues are found, adjust HTML margins/spacing/colors and regenerate the presentation
- Repeat until all slides are visually correct
Edit Existing PowerPoint Presentations
When editing slides in an existing PowerPoint presentation, you must work with the Raw Office Open XML (OOXML) format. This requires unpacking the .pptx file, editing the XML content, and repacking it.
Workflow
- Required - Read the entire file: Read (about 500 lines) from start to finish. Do not set scope limits when reading this file. Read the entire file for detailed guidance on OOXML structure and editing workflows before editing the presentation.
- Unpack the presentation:
python ooxml/scripts/unpack.py <office_file> <output_dir>
- Edit XML files (mainly and related files)
- Important: Validate immediately after each edit and fix validation errors before proceeding:
python ooxml/scripts/validate.py <dir> --original <file>
- Pack the final presentation:
python ooxml/scripts/pack.py <input_directory> <office_file>
Create a New PowerPoint Presentation Using a Template
When you need to create a presentation that follows the design of an existing template, duplicate and rearrange template slides, then replace placeholder content.
Workflow
-
Extract template text and create a visual thumbnail grid:
- Extract text:
python -m markitdown template.pptx > template-content.md
- Read : Read the entire file to understand the content of the template presentation. Do not set scope limits when reading this file.
- Create a thumbnail grid:
python scripts/thumbnail.py template.pptx
- Refer to the Creating Thumbnail Grids section for details
-
Analyze the template and save an inventory to a file:
- Visual analysis: Review the thumbnail grid to understand slide layouts, design patterns, and visual structure
- Create and save a template inventory file in :
markdown
# Template Inventory Analysis
**Total slides: [Number]**
**Important: Slides are 0-indexed (first slide = 0, last slide = count-1)**
## [Category Name]
- Slide 0: [Layout code if available] - Description/purpose
- Slide 1: [Layout code] - Description/purpose
- Slide 2: [Layout code] - Description/purpose
[... List all slides individually with indexes ...]
-
Create a presentation outline based on the template inventory:
- Review the available templates from step 2
- Select an intro or title template for the first slide
- Select safe text-based layouts for other slides
- Important: Match the layout structure to the actual content
- Save the selected layout with content mapping in
-
Duplicate, rearrange, and delete slides using :
bash
python scripts/rearrange.py template.pptx working.pptx 0,34,34,50,52
-
Extract all text using the script:
bash
python scripts/inventory.py working.pptx text-inventory.json
- Read text-inventory.json: Read the entire text-inventory.json file to understand all shapes and their properties.
-
Generate replacement text and save data to a JSON file
- Generate replacement content based on the text inventory from the previous step
- Save the updated inventory to
-
Apply replacements using the script
bash
python scripts/replace.py working.pptx replacement-text.json output.pptx
Creating Thumbnail Grids
To create a visual thumbnail grid of PowerPoint slides for quick analysis and reference:
bash
python scripts/thumbnail.py template.pptx [output_prefix]
Features:
- Creates: (or , , etc. for large decks)
- Default: 5 columns, maximum 30 slides per grid (5×6)
- Custom prefix:
python scripts/thumbnail.py template.pptx my-grid
- Adjust columns: (range: 3-6, affects number of slides per grid)
- Grid limits: 3 columns = 12 slides/grid, 4 columns = 20, 5 columns = 30, 6 columns = 42
- Slides are 0-indexed (slide 0, slide 1, etc.)
Convert Slides to Images
To visually analyze PowerPoint slides, convert them to images using a two-step process:
-
Convert PPTX to PDF:
bash
soffice --headless --convert-to pdf template.pptx
-
Convert PDF pages to JPEG images:
bash
pdftoppm -jpeg -r 150 template.pdf slide
This creates files like
,
, etc.
Code Style Guidelines
Important: When generating code for PPTX operations:
- Write concise code
- Avoid redundant variable names and duplicate operations
- Avoid unnecessary print statements
Dependencies
Required dependencies (should already be installed):
- markitdown:
pip install "markitdown[pptx]"
(for text extraction from presentations)
- pptxgenjs: (for creating presentations with html2pptx)
- playwright:
npm install -g playwright
(for HTML rendering in html2pptx)
- react-icons:
npm install -g react-icons react react-dom
(for icons)
- sharp: (for SVG rasterization and image processing)
- LibreOffice:
sudo apt-get install libreoffice
(for PDF conversion)
- Poppler:
sudo apt-get install poppler-utils
(for converting PDF to images with pdftoppm)
- defusedxml: (for safe XML parsing)