Skip to main content

alignment_test/
alignment_test.rs

1/// Alignment Test Example
2/// 
3/// This example generates a PPTX file that can be compared with python-pptx output.
4/// It demonstrates:
5/// - Presentation metadata (title, author, subject, keywords, comments)
6/// - Multiple slides
7/// - Text formatting
8/// - Basic slide structure
9
10use ppt_rs::generator::{SlideContent, create_pptx_with_content};
11use std::fs;
12
13fn main() -> Result<(), Box<dyn std::error::Error>> {
14    println!("=== Alignment Test: ppt-rs vs python-pptx ===\n");
15    
16    // Create output directory
17    fs::create_dir_all("examples/output")?;
18    
19    // Create slides matching the reference presentation structure
20    let slides = vec![
21        // Slide 1: Title Slide
22        SlideContent::new("Alignment Test Presentation")
23            .title_size(54)
24            .title_bold(true)
25            .title_color("003366"),  // RGB(0, 51, 102)
26        
27        // Slide 2: Content Slide
28        SlideContent::new("Shapes and Formatting")
29            .title_size(44)
30            .title_bold(true)
31            .title_color("003366")
32            .add_bullet("Text formatting (bold, colors, sizes)")
33            .add_bullet("Shape creation and positioning")
34            .add_bullet("Multiple slides and layouts"),
35    ];
36    
37    // Generate PPTX
38    let pptx_data = create_pptx_with_content(
39        "Alignment Test Presentation",
40        slides,
41    )?;
42    
43    // Write to file
44    let output_path = "examples/output/alignment_test_ppt_rs.pptx";
45    fs::write(output_path, pptx_data)?;
46    
47    println!("✓ Created presentation: {output_path}");
48    println!("  - Title: Alignment Test Presentation");
49    println!("  - Slides: 2");
50    println!("\nNext steps:");
51    println!("  1. Open the generated file in PowerPoint to verify");
52    println!("  2. Compare with a python-pptx reference if available");
53    
54    Ok(())
55}
56