PPTX Editing Skill
Provides workflows for editing existing PowerPoint presentations via XML manipulation and template-based approaches.
Template-Based Workflow
- Copy and analyze:
cp template.pptx template.pptx && python -m markitdown template.pptx > template.md - Plan slide mapping: Match content sections to template slides
- Unpack: Extract PPTX into editable XML using Python's
zipfile - Build: Delete/duplicate/reorder slides in
presentation.xml - Edit content: Update text in each
slide{N}.xml - Clean: Remove orphaned files
- Pack: Repack XML tree into PPTX file
Code Example: Extract Text from PPTX
python -m markitdown presentation.pptx
Code Example: Unpack PPTX for Editing
import zipfile
import os
with zipfile.ZipFile("template.pptx", "r") as z:
z.extractall("unpacked/")
Code Example: Repack PPTX
import zipfile
with zipfile.ZipFile("edited.pptx", "w", zipfile.ZIP_DEFLATED) as z:
for root, dirs, files in os.walk("unpacked/"):
for file in files:
path = os.path.join(root, file)
arcname = os.path.relpath(path, "unpacked/")
z.write(path, arcname)
Common Pitfalls
- Forgetting to clean orphaned files: Remove slides not in
<p:sldIdLst> - Smart quotes: Use XML entities (
“) for quotes, not raw characters - Temp file path: Write to
/tmp/first when repacking (zipfile.seek fails on some mounts) - Subagent editing: Use one subagent per slide XML file for parallel editing
Verification Checklist
-
template.mdextracted and content verified - Slide structure changes complete before text editing
- Orphaned files cleaned after structural changes
- All placeholder text replaced
- Final
edited.pptxgenerated and content verified