PPTX Creation, Editing, and Analysis
A .pptx file is a ZIP archive of XML files. Choose your approach by task:
| Task |
Approach |
| Create a new deck |
Write a pptxgenjs script |
| Edit an existing deck |
unzip → edit XML → zip |
| Read content |
markitdown deck.pptx |
Creating with pptxgenjs
pptxgenjs is preinstalled — write the script and require('pptxgenjs') directly.
Critical Gotchas
- Set
pres.layout before adding slides. Default is LAYOUT_16x9 = 10" × 5.625"
- Hex colors: never
#, never 8 digits. Use "FF0000" format
- pptxgenjs mutates option objects in place — build fresh objects per call
- Shadow
offset must be ≥ 0 — negative offsets corrupt the file
letterSpacing is ignored; use charSpacing instead
- Lists:
bullet: true on each item, breakLine: true on all but last
- Speaker notes go in
slide.addNotes("...") (plain text)
- After
writeFile(), run validation: python scripts/office/validate.py deck.pptx
const pptxgen = require('pptxgenjs');
const pres = new pptxgen();
pres.layout = 'LAYOUT_16x9';
const slide = pres.addSlide();
slide.addText('Hello World', {
x: 0.5, y: 0.5, w: 9, h: 1,
fontSize: 44, bold: true,
color: '141413',
fontFace: 'Poppins',
});
pres.writeFile({ fileName: 'output.pptx' });
Editing Existing Decks
# Unpack
python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall('unpacked')" deck.pptx
# Duplicate a slide
python scripts/add_slide.py unpacked/ slide2.xml --after slide2.xml
# Reorder/delete slides = edit <p:sldIdLst> in ppt/presentation.xml
# Clean orphans after deletion
python scripts/clean.py unpacked/
# Repack
(cd unpacked && rm -f ../out.pptx && zip -Xr ../out.pptx .)
# Validate
python scripts/office/validate.py out.pptx --original deck.pptx
Design Ideas
- Pick a bold, content-informed color palette
- One color dominates (60-70%), with 1-2 supporting tones and one accent
- Dark/light contrast for sandwich structure
- Commit to a visual motif — repeat it across every slide
- Every slide needs a visual element (image, chart, icon, shape)
Typography Safe Fonts
Arial, Calibri, Cambria, Times New Roman, Courier New
| Element |
Size |
| Slide title |
36-44pt bold |
| Section header |
20-24pt bold |
| Body text |
14-16pt |
| Captions |
10-12pt |
Common Pitfalls
- ❌ Hex colors with
# prefix — Corrupts the file
- ❌ Sharing option objects across add calls* — pptxgenjs mutates in place
- ❌ Text-only slides — Every slide needs a visual element
- ❌ Accent lines under titles — Hallmark of AI-generated slides
- ❌ Aptos font — Not available in all environments
Verification Checklist
1---2name: pptx3description: Use when creating, editing, or reading PowerPoint files.4---56# PPTX Creation, Editing, and Analysis78A `.pptx` file is a ZIP archive of XML files. Choose your approach by task:910| Task | Approach |11|------|----------|12| **Create** a new deck | Write a `pptxgenjs` script |13| **Edit** an existing deck | unzip → edit XML → zip |14| **Read** content | `markitdown deck.pptx` |1516## Creating with pptxgenjs1718`pptxgenjs` is preinstalled — write the script and `require('pptxgenjs')` directly.1920### Critical Gotchas2122- Set `pres.layout` **before** adding slides. Default is `LAYOUT_16x9` = 10" × 5.625"23- Hex colors: never `#`, never 8 digits. Use `"FF0000"` format24- pptxgenjs mutates option objects in place — build fresh objects per call25- Shadow `offset` must be ≥ 0 — negative offsets corrupt the file26- `letterSpacing` is ignored; use `charSpacing` instead27- Lists: `bullet: true` on each item, `breakLine: true` on all but last28- Speaker notes go in `slide.addNotes("...")` (plain text)29- After `writeFile()`, run validation: `python scripts/office/validate.py deck.pptx`3031```javascript32const pptxgen = require('pptxgenjs');33const pres = new pptxgen();34pres.layout = 'LAYOUT_16x9';3536const slide = pres.addSlide();37slide.addText('Hello World', {38 x: 0.5, y: 0.5, w: 9, h: 1,39 fontSize: 44, bold: true,40 color: '141413',41 fontFace: 'Poppins',42});4344pres.writeFile({ fileName: 'output.pptx' });45```4647## Editing Existing Decks4849```bash50# Unpack51python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall('unpacked')" deck.pptx5253# Duplicate a slide54python scripts/add_slide.py unpacked/ slide2.xml --after slide2.xml5556# Reorder/delete slides = edit <p:sldIdLst> in ppt/presentation.xml5758# Clean orphans after deletion59python scripts/clean.py unpacked/6061# Repack62(cd unpacked && rm -f ../out.pptx && zip -Xr ../out.pptx .)6364# Validate65python scripts/office/validate.py out.pptx --original deck.pptx66```6768## Design Ideas6970- Pick a bold, content-informed color palette71- One color dominates (60-70%), with 1-2 supporting tones and one accent72- Dark/light contrast for sandwich structure73- Commit to a visual motif — repeat it across every slide74- Every slide needs a visual element (image, chart, icon, shape)7576### Typography Safe Fonts77Arial, Calibri, Cambria, Times New Roman, Courier New7879| Element | Size |80|---------|------|81| Slide title | 36-44pt bold |82| Section header | 20-24pt bold |83| Body text | 14-16pt |84| Captions | 10-12pt |8586## Common Pitfalls8788- ❌ **Hex colors with `#` prefix** — Corrupts the file89- ❌ **Sharing option objects across add* calls** — pptxgenjs mutates in place90- ❌ **Text-only slides** — Every slide needs a visual element91- ❌ **Accent lines under titles** — Hallmark of AI-generated slides92- ❌ **Aptos font** — Not available in all environments9394## Verification Checklist9596- [ ] `python scripts/office/validate.py output.pptx` passes97- [ ] No placeholder text remains (grep for xxx, lorem, ipsum, TODO)98- [ ] Visual QA: no text overflow, no overlapping elements99- [ ] Charts render correctly with proper axis configuration100- [ ] Speaker notes are plain text (not text boxes)101- [ ] Colors use proper hex format (no `#`, no 8-digit)