ppt-rs
The Rust library for generating PowerPoint presentations that actually works.
While other Rust crates for PPTX generation are incomplete, broken, or abandoned, ppt-rs generates valid, production-ready PowerPoint files that open correctly in PowerPoint, LibreOffice, Google Slides, and other Office applications.
🎯 Convert Markdown to PowerPoint in seconds - Write your slides in Markdown, get a professional PPTX file. No PowerPoint needed.
Why ppt-rs?
- 🚀 Markdown to PPTX - Write slides in Markdown, get PowerPoint files. Perfect for developers.
- ✅ Actually works - Generates valid PPTX files that open in all major presentation software
- ✅ Complete implementation - Full ECMA-376 Office Open XML compliance
- ✅ Type-safe API - Rust's type system ensures correctness
- ✅ Simple & intuitive - Builder pattern with fluent API
Quick Start
Markdown to PowerPoint (Recommended)
The easiest way to create presentations: write Markdown, get PowerPoint.
1. Create a Markdown file:
- -
- --
- -
2. Convert to PPTX:
# Auto-generates slides.pptx
# Or specify output
# With custom title
That's it! You now have a valid PowerPoint file that opens in PowerPoint, Google Slides, LibreOffice, and more.
Library (Simple API)
use *;
Library (Full API)
use ;
Features
Core Capabilities
- Slides - Multiple layouts (title-only, two-column, blank, etc.)
- Text - Titles, bullets, formatting (bold, italic, colors, sizes)
- Bullet Styles - Numbered, lettered, Roman numerals, custom characters, hierarchical
- Text Enhancements - Strikethrough, highlight, subscript, superscript
- Tables - Multi-line cells, styling, positioning
- Shapes - 100+ shape types with gradient fills and transparency
- Connectors - Straight, elbow, curved with arrows and dash styles
- Charts - Bar, line, pie charts with multiple series
- Images - Embed from files, base64, or bytes
- Reading - Parse and modify existing PPTX files
- Repair - Validate and fix damaged PPTX files
Markdown Format
The Markdown format supports rich content:
| Syntax | Result |
|---|---|
# Heading |
New slide with title |
## Subheading |
Bold bullet point |
- Bullet |
Bullet points (also *, +) |
1. Item |
Numbered list |
**bold** |
Bold text |
*italic* |
Italic text |
`code` |
Inline code |
> Quote |
Speaker notes |
| ` | Table |
```code``` |
Syntax-highlighted code blocks |
```mermaid |
Mermaid diagrams (12 types) |
--- |
Slide break |
Code Block Syntax Highlighting: Code blocks are rendered with Solarized Dark theme colors:
- Blue - Keywords (
fn,let,def,class) - Yellow - Function names
- Cyan - Strings
- Green - Operators, macros
- Violet - Numbers
- Orange - Format specifiers
Example:
- -
```python
print("Hello!")
Conclusion
- Summary
- Q&A
Convert with: `pptcli md2ppt presentation.md` → `presentation.pptx`
## CLI Commands
### Validate PPTX Files
Validate a PPTX file for ECMA-376 compliance:
```bash
pptcli validate presentation.pptx
This checks:
- ZIP archive integrity
- Required XML files presence
- XML validity
- Relationships structure
Show Presentation Information
Repair PPTX Files
Repair damaged or corrupted PPTX files:
use PptxRepair;
// Open and validate
let mut repair = open?;
let issues = repair.validate;
println!;
for issue in &issues
// Repair and save
let result = repair.repair;
if result.is_valid
Detectable Issues:
- Missing required parts (Content_Types.xml, relationships)
- Invalid or malformed XML
- Broken relationship references
- Missing slide references
- Orphan slides
- Invalid content types
Installation
Add to Cargo.toml:
[]
= "0.1"
Examples
Tables
use ;
// Simple table
let table = new
.add_simple_row
.add_simple_row
.build;
// Styled table with formatting
let styled_table = new
.add_row
.add_row
.position
.build;
let slides = vec!;
Charts
use ;
let chart = new
.categories
.add_series
.build;
Shapes
use ;
use ;
// Simple shape with solid fill
let shape = new
.with_fill
.with_text;
// Shape with gradient fill
let gradient_shape = new
.with_gradient
.with_text;
// Shape with transparency
let transparent = new
.with_fill
.with_line;
Connectors
use ;
// Straight connector with arrow
let conn = straight
.with_line
.with_end_arrow
.with_arrow_size;
// Elbow connector with dashed line
let elbow = elbow
.with_line
.with_arrows;
Bullet Styles (NEW in v0.2.1)
use ;
// Numbered list
let slide = new
.add_numbered
.add_numbered
.add_numbered;
// Lettered list (a, b, c)
let slide = new
.add_lettered
.add_lettered;
// Roman numerals (I, II, III)
let slide = new
.add_styled_bullet
.add_styled_bullet
.add_styled_bullet;
// Custom bullet characters
let slide = new
.add_styled_bullet
.add_styled_bullet
.add_styled_bullet;
// Hierarchical (sub-bullets)
let slide = new
.add_bullet
.add_sub_bullet
.add_sub_bullet;
Text Enhancements (NEW in v0.2.1)
use BulletPoint;
use font_sizes;
// Per-bullet formatting
let strikethrough = new.strikethrough;
let highlighted = new.highlight;
let subscript = new.subscript;
let superscript = new.superscript;
let styled = new.bold.color;
// Per-bullet font sizes
let large_text = new.font_size;
let small_text = new.font_size;
// Add to slide
let mut slide = new;
slide.bullets.push;
slide.bullets.push;
slide.bullets.push;
Font Size Presets (NEW in v0.2.1)
use font_sizes;
// Available presets (in points)
TITLE // 44pt
SUBTITLE // 32pt
LARGE // 36pt
HEADING // 28pt
BODY // 18pt
SMALL // 14pt
CAPTION // 12pt
// Use with slide content
let slide = new
.title_size
.content_size;
Images from Base64 (NEW in v0.2.1)
use ;
use inches;
// From base64 encoded string
let base64_png = "iVBORw0KGgoAAAANSUhEUg...";
let img = from_base64
.position;
// From raw bytes
let bytes = vec!; // PNG data
let img = from_bytes;
// Using builder
let img = from_base64
.position
.build;
What Makes This Different
Unlike other Rust PPTX crates that:
- ❌ Generate invalid files that won't open
- ❌ Have incomplete implementations
- ❌ Are abandoned or unmaintained
- ❌ Lack proper XML structure
ppt-rs:
- ✅ Generates valid PPTX files from day one
- ✅ Actively maintained with comprehensive test coverage (700+ tests)
- ✅ Complete XML structure following ECMA-376 standard
- ✅ Validation tools - Built-in validation command for quality assurance
- ✅ Alignment testing - Framework for ensuring compatibility with python-pptx
- ✅ Production-ready - used in real projects
Quality Assurance
Validation
- Built-in validation command for ECMA-376 compliance checking
- Comprehensive test suite (700+ tests)
- Integration tests for end-to-end validation
Alignment Testing
- Framework for comparing output with python-pptx standards
- Alignment testing scripts and documentation
- See docs/ALIGNMENT.md for details
Technical Details
- Version: 0.2.1
- Format: Microsoft PowerPoint 2007+ (.pptx)
- Standard: ECMA-376 Office Open XML
- Compatibility: PowerPoint, LibreOffice, Google Slides, Keynote
- Architecture: Modular design with clear separation of concerns
- Test Coverage: 700+ tests covering all major features
Templates
Create presentations quickly with pre-built templates:
use ;
// Business proposal template
let proposal = business_proposal?;
// Status report template
let status = status_report?;
// Quick simple presentation
let simple = simple?;
Available templates: business_proposal, training_material, status_report, technical_doc, simple
Themes
Pre-defined color themes for consistent styling:
use ;
// Available themes
CORPORATE // Professional blue/gray
MODERN // Clean minimalist
VIBRANT // Bold and colorful
DARK // Dark mode
NATURE // Fresh green
TECH // Technology blue
CARBON // IBM Carbon Design
// Theme properties
let theme = CORPORATE;
println!; // "1565C0"
println!; // "FFFFFF"
Extended Color Palettes (NEW in v0.2.1)
use colors;
// Basic colors
RED, GREEN, BLUE, WHITE, BLACK
// Corporate colors
CORPORATE_BLUE, CORPORATE_GREEN, CORPORATE_RED
// Material Design colors
MATERIAL_RED, MATERIAL_BLUE, MATERIAL_GREEN
MATERIAL_PURPLE, MATERIAL_INDIGO, MATERIAL_CYAN
MATERIAL_TEAL, MATERIAL_LIME, MATERIAL_AMBER
// IBM Carbon Design colors
CARBON_BLUE_60, CARBON_BLUE_40
CARBON_GRAY_100, CARBON_GRAY_80, CARBON_GRAY_20
CARBON_GREEN_50, CARBON_RED_60, CARBON_PURPLE_60
Layout Helpers
Position shapes easily with layout helpers:
use layouts;
// Center a shape on the slide
let = center;
// Create a grid of positions
let positions = grid; // 2x3 grid
// Stack shapes horizontally
let positions = stack_horizontal;
// Evenly distribute shapes
let positions = distribute_horizontal;
Advanced Features
- Prelude Module: Simplified API with macros (
pptx!,shape!), unit helpers (inches(),cm()), and color constants - Templates: Pre-built presentation structures (business proposal, status report, training material, technical doc)
- Gradient Fills: Linear gradients with multiple stops and directions (horizontal, vertical, diagonal, custom angle)
- Transparency: Alpha transparency for solid fills (0-100%)
- Connectors: Straight, elbow, curved with arrow types (triangle, stealth, diamond, oval, open) and dash styles
- Tables: Cell formatting, colors, alignment, borders
- Charts: Bar, line, pie, area, scatter, doughnut, radar, and more
- Shapes: 100+ shape types with fills, outlines, and text
- Animations: 50+ animation effects (fade, fly, zoom, etc.)
- Transitions: 27 slide transition effects
- SmartArt: 25 SmartArt layouts (lists, processes, cycles)
- Media: Video and audio embedding (mp4, webm, mp3, wav)
- 3D Models: GLB, GLTF, OBJ, FBX, STL formats
- VBA Macros: Support for .pptm files with macros
- Custom XML: Embed custom data in presentations
- Themes: Color schemes and font definitions
- Speaker Notes: Add notes to slides
See ARCHITECTURE.md for detailed documentation.
License
Apache-2.0
Contributing
Contributions welcome! See TODO.md for current priorities.