complex_pptx/
complex_pptx.rs1use std::fs;
6use ppt_rs::generator::{SlideContent, create_pptx_with_content};
7
8fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("Generating complex PPTX files...\n");
10
11 fs::create_dir_all("examples/output")?;
13
14 println!("Creating business_presentation.pptx...");
16 let slides = vec![
17 SlideContent::new("Business Overview")
18 .add_bullet("Company mission and vision")
19 .add_bullet("Market position")
20 .add_bullet("Strategic goals"),
21 SlideContent::new("Q1 2025 Results")
22 .add_bullet("Revenue: $2.5M (+15% YoY)")
23 .add_bullet("Customer acquisition: 250 new clients")
24 .add_bullet("Market share increased to 12%"),
25 SlideContent::new("Key Initiatives")
26 .add_bullet("Product roadmap expansion")
27 .add_bullet("Team growth and hiring")
28 .add_bullet("International market entry"),
29 SlideContent::new("Financial Projections")
30 .add_bullet("Q2 target: $2.8M revenue")
31 .add_bullet("Expected 20% growth")
32 .add_bullet("Break-even by Q3"),
33 ];
34
35 let pptx_data = create_pptx_with_content("Business Presentation 2025", slides)?;
36 fs::write("examples/output/business_presentation.pptx", pptx_data)?;
37 println!("✓ Created: examples/output/business_presentation.pptx\n");
38
39 println!("Creating training_course.pptx...");
41 let slides = vec![
42 SlideContent::new("Rust Programming Basics")
43 .add_bullet("Introduction to Rust")
44 .add_bullet("Why Rust matters")
45 .add_bullet("Course objectives"),
46 SlideContent::new("Ownership & Borrowing")
47 .add_bullet("Understanding ownership")
48 .add_bullet("Borrowing and references")
49 .add_bullet("Lifetimes explained"),
50 SlideContent::new("Error Handling")
51 .add_bullet("Result and Option types")
52 .add_bullet("Error propagation")
53 .add_bullet("Best practices"),
54 SlideContent::new("Concurrency")
55 .add_bullet("Threads and channels")
56 .add_bullet("Async/await patterns")
57 .add_bullet("Practical examples"),
58 SlideContent::new("Conclusion")
59 .add_bullet("Key takeaways")
60 .add_bullet("Resources for learning")
61 .add_bullet("Next steps"),
62 ];
63
64 let pptx_data = create_pptx_with_content("Rust Programming Course", slides)?;
65 fs::write("examples/output/training_course.pptx", pptx_data)?;
66 println!("✓ Created: examples/output/training_course.pptx\n");
67
68 println!("Creating project_proposal.pptx...");
70 let slides = vec![
71 SlideContent::new("Project Proposal: PPTX Generator")
72 .add_bullet("Objective: Create a Rust library for PPTX generation")
73 .add_bullet("Timeline: 3 months")
74 .add_bullet("Budget: $50,000"),
75 SlideContent::new("Problem Statement")
76 .add_bullet("Existing Python library is slow")
77 .add_bullet("Need for type-safe solution")
78 .add_bullet("Performance requirements not met"),
79 SlideContent::new("Proposed Solution")
80 .add_bullet("Rust-based PPTX generator")
81 .add_bullet("10x performance improvement")
82 .add_bullet("Full API compatibility"),
83 SlideContent::new("Implementation Plan")
84 .add_bullet("Phase 1: Core ZIP handling (Month 1)")
85 .add_bullet("Phase 2: XML generation (Month 2)")
86 .add_bullet("Phase 3: Testing & optimization (Month 3)"),
87 SlideContent::new("Expected Outcomes")
88 .add_bullet("Production-ready library")
89 .add_bullet("Comprehensive documentation")
90 .add_bullet("100% test coverage"),
91 SlideContent::new("Questions & Discussion"),
92 ];
93
94 let pptx_data = create_pptx_with_content("PPTX Generator Project", slides)?;
95 fs::write("examples/output/project_proposal.pptx", pptx_data)?;
96 println!("✓ Created: examples/output/project_proposal.pptx\n");
97
98 println!("✅ All complex PPTX files generated successfully!");
99 println!("\nGenerated files:");
100 println!(" - examples/output/business_presentation.pptx (4 slides with content)");
101 println!(" - examples/output/training_course.pptx (5 slides with content)");
102 println!(" - examples/output/project_proposal.pptx (6 slides with content)");
103
104 println!("\nVerifying PPTX format:");
106 for file in &[
107 "examples/output/business_presentation.pptx",
108 "examples/output/training_course.pptx",
109 "examples/output/project_proposal.pptx",
110 ] {
111 let metadata = fs::metadata(file)?;
112 let size = metadata.len();
113 println!(" ✓ {} ({} bytes)", file, size);
114 }
115
116 Ok(())
117}