1---2name: document-creator3description: Use when creating, editing, and generating Office documents programmatically — Word, PowerPoint, Excel, and PDF. One interface for all document formats with shared methodology.4license: Apache-2.05---678910# Document Creator1112Generate professional Office documents programmatically across all major formats. Each format has dedicated reference files with library-specific code, but the workflow is shared:1314## Overview1516| Format | Library (Python) | Library (Node.js) | Reference |17|--------|-----------------|-------------------|-----------|18| **Word** (.docx) | python-docx | docx | [reference/format/docx.md](./reference/format/docx.md) |19| **PowerPoint** (.pptx) | python-pptx | pptxgenjs | [reference/format/pptx.md](./reference/format/pptx.md) |20| **Excel** (.xlsx) | openpyxl / xlsxwriter | exceljs / xlsx | [reference/format/xlsx.md](./reference/format/xlsx.md) |21| **PDF** (.pdf) | fpdf2 / reportlab | pdfkit / jspdf | [reference/format/pdf.md](./reference/format/pdf.md) |2223## Workflow24251. **Define structure** — Plan document sections, sheets, slides, or pages262. **Choose format** — Select the right format for the audience (Word for contracts, PPTX for presentations, XLSX for data, PDF for distribution)273. **Load data** — From JSON, CSV, database, or API284. **Generate** — Use the format-specific reference for exact API calls295. **Validate** — Check output opens cleanly in the target application306. **Deliver** — Save or stream to client3132## When to Use3334| Need | Format |35|------|--------|36| Contracts, proposals, reports | **Word** (.docx) |37| Meeting decks, pitches | **PowerPoint** (.pptx) |38| Financial models, data tables | **Excel** (.xlsx) |39| Distribution, printing, archiving | **PDF** |40| Bulk personalized documents | **Word** + mail merge |41| Charts with live data | **Excel** or **PowerPoint** |42| Invoice generation | **PDF** or **Word** |43444546## Anti-Rationalization Table4748| Excuse | Reality | Rule |49|--------|---------|------|50| "I'll just use one library for everything" | Each format has different semantics — one library can't do it all | Use the right library per format (python-docx, python-pptx, openpyxl, fpdf2) |51| "Manual document creation is fine" | Manual creation doesn't scale and introduces errors | Programmatic generation ensures consistency and version control |52| "PDF generation is too complex" | fpdf2 and reportlab handle complex layouts well | Invest in learning the library; it pays off on every document |535455| Need | Format |56|------|--------|57| Contracts, proposals, reports | **Word** (.docx) |58| Meeting decks, pitches | **PowerPoint** (.pptx) |59| Financial models, data tables | **Excel** (.xlsx) |60| Distribution, printing, archiving | **PDF** |61| Bulk personalized documents | **Word** + mail merge |62| Charts with live data | **Excel** or **PowerPoint** |63| Invoice generation | **PDF** or **Word** |6465## Provider Reference6667Load format-specific reference files for exact API usage, code examples, and troubleshooting.68## Process69701. **Define structure** — Plan document sections, sheets, slides, or pages712. **Choose format** — Select the right format for the audience (Word for contracts, PPTX for presentations, XLSX for data, PDF for distribution)723. **Load data** — From JSON, CSV, database, or API734. **Generate** — Use the format-specific reference for exact API calls745. **Validate** — Check output opens cleanly in the target application756. **Deliver** — Save or stream to client7677## Verification Checklist7879- [ ] Output opens correctly in target application (Word, PowerPoint, Excel, PDF viewer)80- [ ] All data populated correctly without truncation81- [ ] Formatting matches specifications (fonts, colors, layout)82- [ ] File size is reasonable for distribution83- [ ] Cross-platform compatibility verified