pub struct PresentationReader { /* private fields */ }Expand description
Presentation reader for parsing PPTX files
Implementations§
Source§impl PresentationReader
impl PresentationReader
Sourcepub fn open(path: &str) -> Result<Self, PptxError>
pub fn open(path: &str) -> Result<Self, PptxError>
Open a PPTX file for reading
Examples found in repository?
examples/edit_presentation.rs (line 113)
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 println!("╔════════════════════════════════════════════════════════════╗");
16 println!("║ PPTX Editing Demo ║");
17 println!("╚════════════════════════════════════════════════════════════╝\n");
18
19 // =========================================================================
20 // Step 1: Create an initial presentation
21 // =========================================================================
22 println!("📝 Step 1: Creating initial presentation...");
23
24 let initial_slides = vec![
25 SlideContent::new("Original Presentation")
26 .layout(SlideLayout::CenteredTitle)
27 .title_bold(true)
28 .title_color("1F497D"),
29
30 SlideContent::new("Slide 1: Introduction")
31 .add_bullet("This is the original content")
32 .add_bullet("Created programmatically"),
33
34 SlideContent::new("Slide 2: Features")
35 .add_bullet("Feature A")
36 .add_bullet("Feature B")
37 .add_bullet("Feature C"),
38 ];
39
40 let pptx_data = create_pptx_with_content("Original Presentation", initial_slides)?;
41 fs::write("original.pptx", &pptx_data)?;
42 println!(" ✓ Created original.pptx with 3 slides\n");
43
44 // =========================================================================
45 // Step 2: Open and inspect the presentation
46 // =========================================================================
47 println!("📖 Step 2: Opening presentation for editing...");
48
49 let mut editor = PresentationEditor::open("original.pptx")?;
50 println!(" ✓ Opened original.pptx");
51 println!(" ├── Slide count: {}", editor.slide_count());
52
53 // Read first slide
54 let slide0 = editor.get_slide(0)?;
55 println!(" └── First slide title: {:?}\n", slide0.title);
56
57 // =========================================================================
58 // Step 3: Add new slides
59 // =========================================================================
60 println!("➕ Step 3: Adding new slides...");
61
62 // Add a new slide at the end
63 let new_slide1 = SlideContent::new("New Slide: Added via Editor")
64 .add_bullet("This slide was added programmatically")
65 .add_bullet("Using PresentationEditor")
66 .add_bullet("After the presentation was created")
67 .title_color("9BBB59");
68
69 let idx1 = editor.add_slide(new_slide1)?;
70 println!(" ✓ Added slide at index {}", idx1);
71
72 // Add another slide
73 let new_slide2 = SlideContent::new("Another New Slide")
74 .layout(SlideLayout::TwoColumn)
75 .add_bullet("Left column item 1")
76 .add_bullet("Left column item 2")
77 .add_bullet("Right column item 1")
78 .add_bullet("Right column item 2");
79
80 let idx2 = editor.add_slide(new_slide2)?;
81 println!(" ✓ Added slide at index {}", idx2);
82 println!(" └── Total slides now: {}\n", editor.slide_count());
83
84 // =========================================================================
85 // Step 4: Update existing slide
86 // =========================================================================
87 println!("✏️ Step 4: Updating existing slide...");
88
89 let updated_slide = SlideContent::new("Slide 2: Updated Features")
90 .add_bullet("Feature A - Enhanced!")
91 .add_bullet("Feature B - Improved!")
92 .add_bullet("Feature C - Optimized!")
93 .add_bullet("Feature D - NEW!")
94 .title_color("C0504D")
95 .content_bold(true);
96
97 editor.update_slide(2, updated_slide)?;
98 println!(" ✓ Updated slide at index 2\n");
99
100 // =========================================================================
101 // Step 5: Save modified presentation
102 // =========================================================================
103 println!("💾 Step 5: Saving modified presentation...");
104
105 editor.save("modified.pptx")?;
106 println!(" ✓ Saved as modified.pptx\n");
107
108 // =========================================================================
109 // Step 6: Verify the changes
110 // =========================================================================
111 println!("🔍 Step 6: Verifying changes...");
112
113 let reader = PresentationReader::open("modified.pptx")?;
114 println!(" Modified presentation:");
115 println!(" ├── Slide count: {}", reader.slide_count());
116
117 for i in 0..reader.slide_count() {
118 let slide = reader.get_slide(i)?;
119 let title = slide.title.as_deref().unwrap_or("(no title)");
120 let bullets = slide.body_text.len();
121 println!(" {}── Slide {}: \"{}\" ({} bullets)",
122 if i == reader.slide_count() - 1 { "└" } else { "├" },
123 i + 1,
124 title,
125 bullets);
126 }
127
128 // =========================================================================
129 // Step 7: Demonstrate slide removal
130 // =========================================================================
131 println!("\n🗑️ Step 7: Demonstrating slide removal...");
132
133 let mut editor2 = PresentationEditor::open("modified.pptx")?;
134 println!(" Before removal: {} slides", editor2.slide_count());
135
136 // Remove the last slide
137 editor2.remove_slide(editor2.slide_count() - 1)?;
138 println!(" ✓ Removed last slide");
139 println!(" After removal: {} slides", editor2.slide_count());
140
141 editor2.save("trimmed.pptx")?;
142 println!(" ✓ Saved as trimmed.pptx");
143
144 // Cleanup
145 fs::remove_file("original.pptx").ok();
146 fs::remove_file("modified.pptx").ok();
147 fs::remove_file("trimmed.pptx").ok();
148
149 // =========================================================================
150 // Summary
151 // =========================================================================
152 println!("\n╔════════════════════════════════════════════════════════════╗");
153 println!("║ Demo Complete ║");
154 println!("╠════════════════════════════════════════════════════════════╣");
155 println!("║ Capabilities Demonstrated: ║");
156 println!("║ ✓ PresentationEditor::open() - Open for editing ║");
157 println!("║ ✓ editor.add_slide() - Add new slides ║");
158 println!("║ ✓ editor.update_slide() - Modify existing slides ║");
159 println!("║ ✓ editor.remove_slide() - Remove slides ║");
160 println!("║ ✓ editor.save() - Save modified presentation ║");
161 println!("║ ✓ editor.get_slide() - Read slide content ║");
162 println!("╚════════════════════════════════════════════════════════════╝");
163
164 Ok(())
165}More examples
examples/read_presentation.rs (line 59)
13fn main() -> Result<(), Box<dyn std::error::Error>> {
14 println!("╔════════════════════════════════════════════════════════════╗");
15 println!("║ PPTX Reading & Parsing Demo ║");
16 println!("╚════════════════════════════════════════════════════════════╝\n");
17
18 // =========================================================================
19 // Step 1: Create a sample PPTX to read
20 // =========================================================================
21 println!("📝 Step 1: Creating sample presentation...");
22
23 let slides = vec![
24 SlideContent::new("Welcome to PPTX-RS")
25 .layout(SlideLayout::CenteredTitle)
26 .title_bold(true)
27 .title_color("1F497D"),
28
29 SlideContent::new("Features Overview")
30 .add_bullet("Create presentations programmatically")
31 .add_bullet("Read existing PPTX files")
32 .add_bullet("Extract text and metadata")
33 .add_bullet("Parse shapes and tables"),
34
35 SlideContent::new("Technical Details")
36 .layout(SlideLayout::TwoColumn)
37 .add_bullet("XML parsing with xml-rs")
38 .add_bullet("ZIP handling with zip crate")
39 .add_bullet("ECMA-376 compliant")
40 .add_bullet("Rust 2024 edition")
41 .add_bullet("Cross-platform")
42 .add_bullet("No external dependencies"),
43
44 SlideContent::new("Summary")
45 .add_bullet("Full read/write support")
46 .add_bullet("Comprehensive API")
47 .add_bullet("Well tested"),
48 ];
49
50 let pptx_data = create_pptx_with_content("PPTX-RS Demo", slides)?;
51 fs::write("sample_presentation.pptx", &pptx_data)?;
52 println!(" ✓ Created sample_presentation.pptx ({} bytes)\n", pptx_data.len());
53
54 // =========================================================================
55 // Step 2: Open and read the presentation
56 // =========================================================================
57 println!("📖 Step 2: Opening presentation...");
58
59 let reader = PresentationReader::open("sample_presentation.pptx")?;
60 let info = reader.info();
61
62 println!(" Presentation Info:");
63 println!(" ├── Title: {}", info.title.as_deref().unwrap_or("(none)"));
64 println!(" ├── Creator: {}", info.creator.as_deref().unwrap_or("(none)"));
65 println!(" ├── Slides: {}", info.slide_count);
66 println!(" └── Revision: {}\n", info.revision.unwrap_or(0));
67
68 // =========================================================================
69 // Step 3: Parse each slide
70 // =========================================================================
71 println!("📑 Step 3: Parsing slides...");
72
73 for i in 0..reader.slide_count() {
74 let slide = reader.get_slide(i)?;
75
76 println!("\n Slide {}:", i + 1);
77 println!(" ├── Title: {}", slide.title.as_deref().unwrap_or("(none)"));
78 println!(" ├── Shapes: {}", slide.shapes.len());
79 println!(" ├── Tables: {}", slide.tables.len());
80
81 if !slide.body_text.is_empty() {
82 println!(" └── Body text:");
83 for (j, text) in slide.body_text.iter().enumerate() {
84 let prefix = if j == slide.body_text.len() - 1 { " └──" } else { " ├──" };
85 println!("{} {}", prefix, text);
86 }
87 } else {
88 println!(" └── Body text: (none)");
89 }
90 }
91
92 // =========================================================================
93 // Step 4: Extract all text
94 // =========================================================================
95 println!("\n📋 Step 4: Extracting all text...");
96
97 let all_text = reader.extract_all_text()?;
98 println!(" Found {} text items:", all_text.len());
99 for (i, text) in all_text.iter().take(10).enumerate() {
100 println!(" {}. {}", i + 1, text);
101 }
102 if all_text.len() > 10 {
103 println!(" ... and {} more", all_text.len() - 10);
104 }
105
106 // =========================================================================
107 // Step 5: Direct XML parsing (advanced)
108 // =========================================================================
109 println!("\n🔧 Step 5: Direct XML parsing (advanced)...");
110
111 // You can also parse slide XML directly
112 let sample_xml = r#"<?xml version="1.0" encoding="UTF-8"?>
113 <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
114 xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
115 <p:cSld>
116 <p:spTree>
117 <p:sp>
118 <p:nvSpPr>
119 <p:cNvPr id="2" name="Title"/>
120 <p:nvPr><p:ph type="title"/></p:nvPr>
121 </p:nvSpPr>
122 <p:txBody>
123 <a:p>
124 <a:r>
125 <a:rPr b="1" sz="4400"/>
126 <a:t>Direct Parse Example</a:t>
127 </a:r>
128 </a:p>
129 </p:txBody>
130 </p:sp>
131 </p:spTree>
132 </p:cSld>
133 </p:sld>"#;
134
135 let parsed = SlideParser::parse(sample_xml)?;
136 println!(" Parsed XML directly:");
137 println!(" ├── Title: {}", parsed.title.as_deref().unwrap_or("(none)"));
138 println!(" └── Shapes: {}", parsed.shapes.len());
139
140 if let Some(shape) = parsed.shapes.first() {
141 if let Some(para) = shape.paragraphs.first() {
142 if let Some(run) = para.runs.first() {
143 println!("\n Text formatting detected:");
144 println!(" ├── Bold: {}", run.bold);
145 println!(" ├── Font size: {:?}", run.font_size);
146 println!(" └── Text: {}", run.text);
147 }
148 }
149 }
150
151 // Cleanup
152 fs::remove_file("sample_presentation.pptx").ok();
153
154 // =========================================================================
155 // Summary
156 // =========================================================================
157 println!("\n╔════════════════════════════════════════════════════════════╗");
158 println!("║ Demo Complete ║");
159 println!("╠════════════════════════════════════════════════════════════╣");
160 println!("║ Capabilities Demonstrated: ║");
161 println!("║ ✓ PresentationReader::open() - Open PPTX files ║");
162 println!("║ ✓ reader.info() - Get presentation metadata ║");
163 println!("║ ✓ reader.get_slide(i) - Parse individual slides ║");
164 println!("║ ✓ reader.extract_all_text() - Extract all text ║");
165 println!("║ ✓ SlideParser::parse() - Direct XML parsing ║");
166 println!("╚════════════════════════════════════════════════════════════╝");
167
168 Ok(())
169}Sourcepub fn info(&self) -> &PresentationInfo
pub fn info(&self) -> &PresentationInfo
Get presentation info
Examples found in repository?
examples/read_presentation.rs (line 60)
13fn main() -> Result<(), Box<dyn std::error::Error>> {
14 println!("╔════════════════════════════════════════════════════════════╗");
15 println!("║ PPTX Reading & Parsing Demo ║");
16 println!("╚════════════════════════════════════════════════════════════╝\n");
17
18 // =========================================================================
19 // Step 1: Create a sample PPTX to read
20 // =========================================================================
21 println!("📝 Step 1: Creating sample presentation...");
22
23 let slides = vec![
24 SlideContent::new("Welcome to PPTX-RS")
25 .layout(SlideLayout::CenteredTitle)
26 .title_bold(true)
27 .title_color("1F497D"),
28
29 SlideContent::new("Features Overview")
30 .add_bullet("Create presentations programmatically")
31 .add_bullet("Read existing PPTX files")
32 .add_bullet("Extract text and metadata")
33 .add_bullet("Parse shapes and tables"),
34
35 SlideContent::new("Technical Details")
36 .layout(SlideLayout::TwoColumn)
37 .add_bullet("XML parsing with xml-rs")
38 .add_bullet("ZIP handling with zip crate")
39 .add_bullet("ECMA-376 compliant")
40 .add_bullet("Rust 2024 edition")
41 .add_bullet("Cross-platform")
42 .add_bullet("No external dependencies"),
43
44 SlideContent::new("Summary")
45 .add_bullet("Full read/write support")
46 .add_bullet("Comprehensive API")
47 .add_bullet("Well tested"),
48 ];
49
50 let pptx_data = create_pptx_with_content("PPTX-RS Demo", slides)?;
51 fs::write("sample_presentation.pptx", &pptx_data)?;
52 println!(" ✓ Created sample_presentation.pptx ({} bytes)\n", pptx_data.len());
53
54 // =========================================================================
55 // Step 2: Open and read the presentation
56 // =========================================================================
57 println!("📖 Step 2: Opening presentation...");
58
59 let reader = PresentationReader::open("sample_presentation.pptx")?;
60 let info = reader.info();
61
62 println!(" Presentation Info:");
63 println!(" ├── Title: {}", info.title.as_deref().unwrap_or("(none)"));
64 println!(" ├── Creator: {}", info.creator.as_deref().unwrap_or("(none)"));
65 println!(" ├── Slides: {}", info.slide_count);
66 println!(" └── Revision: {}\n", info.revision.unwrap_or(0));
67
68 // =========================================================================
69 // Step 3: Parse each slide
70 // =========================================================================
71 println!("📑 Step 3: Parsing slides...");
72
73 for i in 0..reader.slide_count() {
74 let slide = reader.get_slide(i)?;
75
76 println!("\n Slide {}:", i + 1);
77 println!(" ├── Title: {}", slide.title.as_deref().unwrap_or("(none)"));
78 println!(" ├── Shapes: {}", slide.shapes.len());
79 println!(" ├── Tables: {}", slide.tables.len());
80
81 if !slide.body_text.is_empty() {
82 println!(" └── Body text:");
83 for (j, text) in slide.body_text.iter().enumerate() {
84 let prefix = if j == slide.body_text.len() - 1 { " └──" } else { " ├──" };
85 println!("{} {}", prefix, text);
86 }
87 } else {
88 println!(" └── Body text: (none)");
89 }
90 }
91
92 // =========================================================================
93 // Step 4: Extract all text
94 // =========================================================================
95 println!("\n📋 Step 4: Extracting all text...");
96
97 let all_text = reader.extract_all_text()?;
98 println!(" Found {} text items:", all_text.len());
99 for (i, text) in all_text.iter().take(10).enumerate() {
100 println!(" {}. {}", i + 1, text);
101 }
102 if all_text.len() > 10 {
103 println!(" ... and {} more", all_text.len() - 10);
104 }
105
106 // =========================================================================
107 // Step 5: Direct XML parsing (advanced)
108 // =========================================================================
109 println!("\n🔧 Step 5: Direct XML parsing (advanced)...");
110
111 // You can also parse slide XML directly
112 let sample_xml = r#"<?xml version="1.0" encoding="UTF-8"?>
113 <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
114 xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
115 <p:cSld>
116 <p:spTree>
117 <p:sp>
118 <p:nvSpPr>
119 <p:cNvPr id="2" name="Title"/>
120 <p:nvPr><p:ph type="title"/></p:nvPr>
121 </p:nvSpPr>
122 <p:txBody>
123 <a:p>
124 <a:r>
125 <a:rPr b="1" sz="4400"/>
126 <a:t>Direct Parse Example</a:t>
127 </a:r>
128 </a:p>
129 </p:txBody>
130 </p:sp>
131 </p:spTree>
132 </p:cSld>
133 </p:sld>"#;
134
135 let parsed = SlideParser::parse(sample_xml)?;
136 println!(" Parsed XML directly:");
137 println!(" ├── Title: {}", parsed.title.as_deref().unwrap_or("(none)"));
138 println!(" └── Shapes: {}", parsed.shapes.len());
139
140 if let Some(shape) = parsed.shapes.first() {
141 if let Some(para) = shape.paragraphs.first() {
142 if let Some(run) = para.runs.first() {
143 println!("\n Text formatting detected:");
144 println!(" ├── Bold: {}", run.bold);
145 println!(" ├── Font size: {:?}", run.font_size);
146 println!(" └── Text: {}", run.text);
147 }
148 }
149 }
150
151 // Cleanup
152 fs::remove_file("sample_presentation.pptx").ok();
153
154 // =========================================================================
155 // Summary
156 // =========================================================================
157 println!("\n╔════════════════════════════════════════════════════════════╗");
158 println!("║ Demo Complete ║");
159 println!("╠════════════════════════════════════════════════════════════╣");
160 println!("║ Capabilities Demonstrated: ║");
161 println!("║ ✓ PresentationReader::open() - Open PPTX files ║");
162 println!("║ ✓ reader.info() - Get presentation metadata ║");
163 println!("║ ✓ reader.get_slide(i) - Parse individual slides ║");
164 println!("║ ✓ reader.extract_all_text() - Extract all text ║");
165 println!("║ ✓ SlideParser::parse() - Direct XML parsing ║");
166 println!("╚════════════════════════════════════════════════════════════╝");
167
168 Ok(())
169}Sourcepub fn slide_count(&self) -> usize
pub fn slide_count(&self) -> usize
Get number of slides
Examples found in repository?
examples/edit_presentation.rs (line 115)
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 println!("╔════════════════════════════════════════════════════════════╗");
16 println!("║ PPTX Editing Demo ║");
17 println!("╚════════════════════════════════════════════════════════════╝\n");
18
19 // =========================================================================
20 // Step 1: Create an initial presentation
21 // =========================================================================
22 println!("📝 Step 1: Creating initial presentation...");
23
24 let initial_slides = vec![
25 SlideContent::new("Original Presentation")
26 .layout(SlideLayout::CenteredTitle)
27 .title_bold(true)
28 .title_color("1F497D"),
29
30 SlideContent::new("Slide 1: Introduction")
31 .add_bullet("This is the original content")
32 .add_bullet("Created programmatically"),
33
34 SlideContent::new("Slide 2: Features")
35 .add_bullet("Feature A")
36 .add_bullet("Feature B")
37 .add_bullet("Feature C"),
38 ];
39
40 let pptx_data = create_pptx_with_content("Original Presentation", initial_slides)?;
41 fs::write("original.pptx", &pptx_data)?;
42 println!(" ✓ Created original.pptx with 3 slides\n");
43
44 // =========================================================================
45 // Step 2: Open and inspect the presentation
46 // =========================================================================
47 println!("📖 Step 2: Opening presentation for editing...");
48
49 let mut editor = PresentationEditor::open("original.pptx")?;
50 println!(" ✓ Opened original.pptx");
51 println!(" ├── Slide count: {}", editor.slide_count());
52
53 // Read first slide
54 let slide0 = editor.get_slide(0)?;
55 println!(" └── First slide title: {:?}\n", slide0.title);
56
57 // =========================================================================
58 // Step 3: Add new slides
59 // =========================================================================
60 println!("➕ Step 3: Adding new slides...");
61
62 // Add a new slide at the end
63 let new_slide1 = SlideContent::new("New Slide: Added via Editor")
64 .add_bullet("This slide was added programmatically")
65 .add_bullet("Using PresentationEditor")
66 .add_bullet("After the presentation was created")
67 .title_color("9BBB59");
68
69 let idx1 = editor.add_slide(new_slide1)?;
70 println!(" ✓ Added slide at index {}", idx1);
71
72 // Add another slide
73 let new_slide2 = SlideContent::new("Another New Slide")
74 .layout(SlideLayout::TwoColumn)
75 .add_bullet("Left column item 1")
76 .add_bullet("Left column item 2")
77 .add_bullet("Right column item 1")
78 .add_bullet("Right column item 2");
79
80 let idx2 = editor.add_slide(new_slide2)?;
81 println!(" ✓ Added slide at index {}", idx2);
82 println!(" └── Total slides now: {}\n", editor.slide_count());
83
84 // =========================================================================
85 // Step 4: Update existing slide
86 // =========================================================================
87 println!("✏️ Step 4: Updating existing slide...");
88
89 let updated_slide = SlideContent::new("Slide 2: Updated Features")
90 .add_bullet("Feature A - Enhanced!")
91 .add_bullet("Feature B - Improved!")
92 .add_bullet("Feature C - Optimized!")
93 .add_bullet("Feature D - NEW!")
94 .title_color("C0504D")
95 .content_bold(true);
96
97 editor.update_slide(2, updated_slide)?;
98 println!(" ✓ Updated slide at index 2\n");
99
100 // =========================================================================
101 // Step 5: Save modified presentation
102 // =========================================================================
103 println!("💾 Step 5: Saving modified presentation...");
104
105 editor.save("modified.pptx")?;
106 println!(" ✓ Saved as modified.pptx\n");
107
108 // =========================================================================
109 // Step 6: Verify the changes
110 // =========================================================================
111 println!("🔍 Step 6: Verifying changes...");
112
113 let reader = PresentationReader::open("modified.pptx")?;
114 println!(" Modified presentation:");
115 println!(" ├── Slide count: {}", reader.slide_count());
116
117 for i in 0..reader.slide_count() {
118 let slide = reader.get_slide(i)?;
119 let title = slide.title.as_deref().unwrap_or("(no title)");
120 let bullets = slide.body_text.len();
121 println!(" {}── Slide {}: \"{}\" ({} bullets)",
122 if i == reader.slide_count() - 1 { "└" } else { "├" },
123 i + 1,
124 title,
125 bullets);
126 }
127
128 // =========================================================================
129 // Step 7: Demonstrate slide removal
130 // =========================================================================
131 println!("\n🗑️ Step 7: Demonstrating slide removal...");
132
133 let mut editor2 = PresentationEditor::open("modified.pptx")?;
134 println!(" Before removal: {} slides", editor2.slide_count());
135
136 // Remove the last slide
137 editor2.remove_slide(editor2.slide_count() - 1)?;
138 println!(" ✓ Removed last slide");
139 println!(" After removal: {} slides", editor2.slide_count());
140
141 editor2.save("trimmed.pptx")?;
142 println!(" ✓ Saved as trimmed.pptx");
143
144 // Cleanup
145 fs::remove_file("original.pptx").ok();
146 fs::remove_file("modified.pptx").ok();
147 fs::remove_file("trimmed.pptx").ok();
148
149 // =========================================================================
150 // Summary
151 // =========================================================================
152 println!("\n╔════════════════════════════════════════════════════════════╗");
153 println!("║ Demo Complete ║");
154 println!("╠════════════════════════════════════════════════════════════╣");
155 println!("║ Capabilities Demonstrated: ║");
156 println!("║ ✓ PresentationEditor::open() - Open for editing ║");
157 println!("║ ✓ editor.add_slide() - Add new slides ║");
158 println!("║ ✓ editor.update_slide() - Modify existing slides ║");
159 println!("║ ✓ editor.remove_slide() - Remove slides ║");
160 println!("║ ✓ editor.save() - Save modified presentation ║");
161 println!("║ ✓ editor.get_slide() - Read slide content ║");
162 println!("╚════════════════════════════════════════════════════════════╝");
163
164 Ok(())
165}More examples
examples/read_presentation.rs (line 73)
13fn main() -> Result<(), Box<dyn std::error::Error>> {
14 println!("╔════════════════════════════════════════════════════════════╗");
15 println!("║ PPTX Reading & Parsing Demo ║");
16 println!("╚════════════════════════════════════════════════════════════╝\n");
17
18 // =========================================================================
19 // Step 1: Create a sample PPTX to read
20 // =========================================================================
21 println!("📝 Step 1: Creating sample presentation...");
22
23 let slides = vec![
24 SlideContent::new("Welcome to PPTX-RS")
25 .layout(SlideLayout::CenteredTitle)
26 .title_bold(true)
27 .title_color("1F497D"),
28
29 SlideContent::new("Features Overview")
30 .add_bullet("Create presentations programmatically")
31 .add_bullet("Read existing PPTX files")
32 .add_bullet("Extract text and metadata")
33 .add_bullet("Parse shapes and tables"),
34
35 SlideContent::new("Technical Details")
36 .layout(SlideLayout::TwoColumn)
37 .add_bullet("XML parsing with xml-rs")
38 .add_bullet("ZIP handling with zip crate")
39 .add_bullet("ECMA-376 compliant")
40 .add_bullet("Rust 2024 edition")
41 .add_bullet("Cross-platform")
42 .add_bullet("No external dependencies"),
43
44 SlideContent::new("Summary")
45 .add_bullet("Full read/write support")
46 .add_bullet("Comprehensive API")
47 .add_bullet("Well tested"),
48 ];
49
50 let pptx_data = create_pptx_with_content("PPTX-RS Demo", slides)?;
51 fs::write("sample_presentation.pptx", &pptx_data)?;
52 println!(" ✓ Created sample_presentation.pptx ({} bytes)\n", pptx_data.len());
53
54 // =========================================================================
55 // Step 2: Open and read the presentation
56 // =========================================================================
57 println!("📖 Step 2: Opening presentation...");
58
59 let reader = PresentationReader::open("sample_presentation.pptx")?;
60 let info = reader.info();
61
62 println!(" Presentation Info:");
63 println!(" ├── Title: {}", info.title.as_deref().unwrap_or("(none)"));
64 println!(" ├── Creator: {}", info.creator.as_deref().unwrap_or("(none)"));
65 println!(" ├── Slides: {}", info.slide_count);
66 println!(" └── Revision: {}\n", info.revision.unwrap_or(0));
67
68 // =========================================================================
69 // Step 3: Parse each slide
70 // =========================================================================
71 println!("📑 Step 3: Parsing slides...");
72
73 for i in 0..reader.slide_count() {
74 let slide = reader.get_slide(i)?;
75
76 println!("\n Slide {}:", i + 1);
77 println!(" ├── Title: {}", slide.title.as_deref().unwrap_or("(none)"));
78 println!(" ├── Shapes: {}", slide.shapes.len());
79 println!(" ├── Tables: {}", slide.tables.len());
80
81 if !slide.body_text.is_empty() {
82 println!(" └── Body text:");
83 for (j, text) in slide.body_text.iter().enumerate() {
84 let prefix = if j == slide.body_text.len() - 1 { " └──" } else { " ├──" };
85 println!("{} {}", prefix, text);
86 }
87 } else {
88 println!(" └── Body text: (none)");
89 }
90 }
91
92 // =========================================================================
93 // Step 4: Extract all text
94 // =========================================================================
95 println!("\n📋 Step 4: Extracting all text...");
96
97 let all_text = reader.extract_all_text()?;
98 println!(" Found {} text items:", all_text.len());
99 for (i, text) in all_text.iter().take(10).enumerate() {
100 println!(" {}. {}", i + 1, text);
101 }
102 if all_text.len() > 10 {
103 println!(" ... and {} more", all_text.len() - 10);
104 }
105
106 // =========================================================================
107 // Step 5: Direct XML parsing (advanced)
108 // =========================================================================
109 println!("\n🔧 Step 5: Direct XML parsing (advanced)...");
110
111 // You can also parse slide XML directly
112 let sample_xml = r#"<?xml version="1.0" encoding="UTF-8"?>
113 <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
114 xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
115 <p:cSld>
116 <p:spTree>
117 <p:sp>
118 <p:nvSpPr>
119 <p:cNvPr id="2" name="Title"/>
120 <p:nvPr><p:ph type="title"/></p:nvPr>
121 </p:nvSpPr>
122 <p:txBody>
123 <a:p>
124 <a:r>
125 <a:rPr b="1" sz="4400"/>
126 <a:t>Direct Parse Example</a:t>
127 </a:r>
128 </a:p>
129 </p:txBody>
130 </p:sp>
131 </p:spTree>
132 </p:cSld>
133 </p:sld>"#;
134
135 let parsed = SlideParser::parse(sample_xml)?;
136 println!(" Parsed XML directly:");
137 println!(" ├── Title: {}", parsed.title.as_deref().unwrap_or("(none)"));
138 println!(" └── Shapes: {}", parsed.shapes.len());
139
140 if let Some(shape) = parsed.shapes.first() {
141 if let Some(para) = shape.paragraphs.first() {
142 if let Some(run) = para.runs.first() {
143 println!("\n Text formatting detected:");
144 println!(" ├── Bold: {}", run.bold);
145 println!(" ├── Font size: {:?}", run.font_size);
146 println!(" └── Text: {}", run.text);
147 }
148 }
149 }
150
151 // Cleanup
152 fs::remove_file("sample_presentation.pptx").ok();
153
154 // =========================================================================
155 // Summary
156 // =========================================================================
157 println!("\n╔════════════════════════════════════════════════════════════╗");
158 println!("║ Demo Complete ║");
159 println!("╠════════════════════════════════════════════════════════════╣");
160 println!("║ Capabilities Demonstrated: ║");
161 println!("║ ✓ PresentationReader::open() - Open PPTX files ║");
162 println!("║ ✓ reader.info() - Get presentation metadata ║");
163 println!("║ ✓ reader.get_slide(i) - Parse individual slides ║");
164 println!("║ ✓ reader.extract_all_text() - Extract all text ║");
165 println!("║ ✓ SlideParser::parse() - Direct XML parsing ║");
166 println!("╚════════════════════════════════════════════════════════════╝");
167
168 Ok(())
169}Sourcepub fn get_slide(&self, index: usize) -> Result<ParsedSlide, PptxError>
pub fn get_slide(&self, index: usize) -> Result<ParsedSlide, PptxError>
Get slide by index (0-based)
Examples found in repository?
examples/edit_presentation.rs (line 118)
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 println!("╔════════════════════════════════════════════════════════════╗");
16 println!("║ PPTX Editing Demo ║");
17 println!("╚════════════════════════════════════════════════════════════╝\n");
18
19 // =========================================================================
20 // Step 1: Create an initial presentation
21 // =========================================================================
22 println!("📝 Step 1: Creating initial presentation...");
23
24 let initial_slides = vec![
25 SlideContent::new("Original Presentation")
26 .layout(SlideLayout::CenteredTitle)
27 .title_bold(true)
28 .title_color("1F497D"),
29
30 SlideContent::new("Slide 1: Introduction")
31 .add_bullet("This is the original content")
32 .add_bullet("Created programmatically"),
33
34 SlideContent::new("Slide 2: Features")
35 .add_bullet("Feature A")
36 .add_bullet("Feature B")
37 .add_bullet("Feature C"),
38 ];
39
40 let pptx_data = create_pptx_with_content("Original Presentation", initial_slides)?;
41 fs::write("original.pptx", &pptx_data)?;
42 println!(" ✓ Created original.pptx with 3 slides\n");
43
44 // =========================================================================
45 // Step 2: Open and inspect the presentation
46 // =========================================================================
47 println!("📖 Step 2: Opening presentation for editing...");
48
49 let mut editor = PresentationEditor::open("original.pptx")?;
50 println!(" ✓ Opened original.pptx");
51 println!(" ├── Slide count: {}", editor.slide_count());
52
53 // Read first slide
54 let slide0 = editor.get_slide(0)?;
55 println!(" └── First slide title: {:?}\n", slide0.title);
56
57 // =========================================================================
58 // Step 3: Add new slides
59 // =========================================================================
60 println!("➕ Step 3: Adding new slides...");
61
62 // Add a new slide at the end
63 let new_slide1 = SlideContent::new("New Slide: Added via Editor")
64 .add_bullet("This slide was added programmatically")
65 .add_bullet("Using PresentationEditor")
66 .add_bullet("After the presentation was created")
67 .title_color("9BBB59");
68
69 let idx1 = editor.add_slide(new_slide1)?;
70 println!(" ✓ Added slide at index {}", idx1);
71
72 // Add another slide
73 let new_slide2 = SlideContent::new("Another New Slide")
74 .layout(SlideLayout::TwoColumn)
75 .add_bullet("Left column item 1")
76 .add_bullet("Left column item 2")
77 .add_bullet("Right column item 1")
78 .add_bullet("Right column item 2");
79
80 let idx2 = editor.add_slide(new_slide2)?;
81 println!(" ✓ Added slide at index {}", idx2);
82 println!(" └── Total slides now: {}\n", editor.slide_count());
83
84 // =========================================================================
85 // Step 4: Update existing slide
86 // =========================================================================
87 println!("✏️ Step 4: Updating existing slide...");
88
89 let updated_slide = SlideContent::new("Slide 2: Updated Features")
90 .add_bullet("Feature A - Enhanced!")
91 .add_bullet("Feature B - Improved!")
92 .add_bullet("Feature C - Optimized!")
93 .add_bullet("Feature D - NEW!")
94 .title_color("C0504D")
95 .content_bold(true);
96
97 editor.update_slide(2, updated_slide)?;
98 println!(" ✓ Updated slide at index 2\n");
99
100 // =========================================================================
101 // Step 5: Save modified presentation
102 // =========================================================================
103 println!("💾 Step 5: Saving modified presentation...");
104
105 editor.save("modified.pptx")?;
106 println!(" ✓ Saved as modified.pptx\n");
107
108 // =========================================================================
109 // Step 6: Verify the changes
110 // =========================================================================
111 println!("🔍 Step 6: Verifying changes...");
112
113 let reader = PresentationReader::open("modified.pptx")?;
114 println!(" Modified presentation:");
115 println!(" ├── Slide count: {}", reader.slide_count());
116
117 for i in 0..reader.slide_count() {
118 let slide = reader.get_slide(i)?;
119 let title = slide.title.as_deref().unwrap_or("(no title)");
120 let bullets = slide.body_text.len();
121 println!(" {}── Slide {}: \"{}\" ({} bullets)",
122 if i == reader.slide_count() - 1 { "└" } else { "├" },
123 i + 1,
124 title,
125 bullets);
126 }
127
128 // =========================================================================
129 // Step 7: Demonstrate slide removal
130 // =========================================================================
131 println!("\n🗑️ Step 7: Demonstrating slide removal...");
132
133 let mut editor2 = PresentationEditor::open("modified.pptx")?;
134 println!(" Before removal: {} slides", editor2.slide_count());
135
136 // Remove the last slide
137 editor2.remove_slide(editor2.slide_count() - 1)?;
138 println!(" ✓ Removed last slide");
139 println!(" After removal: {} slides", editor2.slide_count());
140
141 editor2.save("trimmed.pptx")?;
142 println!(" ✓ Saved as trimmed.pptx");
143
144 // Cleanup
145 fs::remove_file("original.pptx").ok();
146 fs::remove_file("modified.pptx").ok();
147 fs::remove_file("trimmed.pptx").ok();
148
149 // =========================================================================
150 // Summary
151 // =========================================================================
152 println!("\n╔════════════════════════════════════════════════════════════╗");
153 println!("║ Demo Complete ║");
154 println!("╠════════════════════════════════════════════════════════════╣");
155 println!("║ Capabilities Demonstrated: ║");
156 println!("║ ✓ PresentationEditor::open() - Open for editing ║");
157 println!("║ ✓ editor.add_slide() - Add new slides ║");
158 println!("║ ✓ editor.update_slide() - Modify existing slides ║");
159 println!("║ ✓ editor.remove_slide() - Remove slides ║");
160 println!("║ ✓ editor.save() - Save modified presentation ║");
161 println!("║ ✓ editor.get_slide() - Read slide content ║");
162 println!("╚════════════════════════════════════════════════════════════╝");
163
164 Ok(())
165}More examples
examples/read_presentation.rs (line 74)
13fn main() -> Result<(), Box<dyn std::error::Error>> {
14 println!("╔════════════════════════════════════════════════════════════╗");
15 println!("║ PPTX Reading & Parsing Demo ║");
16 println!("╚════════════════════════════════════════════════════════════╝\n");
17
18 // =========================================================================
19 // Step 1: Create a sample PPTX to read
20 // =========================================================================
21 println!("📝 Step 1: Creating sample presentation...");
22
23 let slides = vec![
24 SlideContent::new("Welcome to PPTX-RS")
25 .layout(SlideLayout::CenteredTitle)
26 .title_bold(true)
27 .title_color("1F497D"),
28
29 SlideContent::new("Features Overview")
30 .add_bullet("Create presentations programmatically")
31 .add_bullet("Read existing PPTX files")
32 .add_bullet("Extract text and metadata")
33 .add_bullet("Parse shapes and tables"),
34
35 SlideContent::new("Technical Details")
36 .layout(SlideLayout::TwoColumn)
37 .add_bullet("XML parsing with xml-rs")
38 .add_bullet("ZIP handling with zip crate")
39 .add_bullet("ECMA-376 compliant")
40 .add_bullet("Rust 2024 edition")
41 .add_bullet("Cross-platform")
42 .add_bullet("No external dependencies"),
43
44 SlideContent::new("Summary")
45 .add_bullet("Full read/write support")
46 .add_bullet("Comprehensive API")
47 .add_bullet("Well tested"),
48 ];
49
50 let pptx_data = create_pptx_with_content("PPTX-RS Demo", slides)?;
51 fs::write("sample_presentation.pptx", &pptx_data)?;
52 println!(" ✓ Created sample_presentation.pptx ({} bytes)\n", pptx_data.len());
53
54 // =========================================================================
55 // Step 2: Open and read the presentation
56 // =========================================================================
57 println!("📖 Step 2: Opening presentation...");
58
59 let reader = PresentationReader::open("sample_presentation.pptx")?;
60 let info = reader.info();
61
62 println!(" Presentation Info:");
63 println!(" ├── Title: {}", info.title.as_deref().unwrap_or("(none)"));
64 println!(" ├── Creator: {}", info.creator.as_deref().unwrap_or("(none)"));
65 println!(" ├── Slides: {}", info.slide_count);
66 println!(" └── Revision: {}\n", info.revision.unwrap_or(0));
67
68 // =========================================================================
69 // Step 3: Parse each slide
70 // =========================================================================
71 println!("📑 Step 3: Parsing slides...");
72
73 for i in 0..reader.slide_count() {
74 let slide = reader.get_slide(i)?;
75
76 println!("\n Slide {}:", i + 1);
77 println!(" ├── Title: {}", slide.title.as_deref().unwrap_or("(none)"));
78 println!(" ├── Shapes: {}", slide.shapes.len());
79 println!(" ├── Tables: {}", slide.tables.len());
80
81 if !slide.body_text.is_empty() {
82 println!(" └── Body text:");
83 for (j, text) in slide.body_text.iter().enumerate() {
84 let prefix = if j == slide.body_text.len() - 1 { " └──" } else { " ├──" };
85 println!("{} {}", prefix, text);
86 }
87 } else {
88 println!(" └── Body text: (none)");
89 }
90 }
91
92 // =========================================================================
93 // Step 4: Extract all text
94 // =========================================================================
95 println!("\n📋 Step 4: Extracting all text...");
96
97 let all_text = reader.extract_all_text()?;
98 println!(" Found {} text items:", all_text.len());
99 for (i, text) in all_text.iter().take(10).enumerate() {
100 println!(" {}. {}", i + 1, text);
101 }
102 if all_text.len() > 10 {
103 println!(" ... and {} more", all_text.len() - 10);
104 }
105
106 // =========================================================================
107 // Step 5: Direct XML parsing (advanced)
108 // =========================================================================
109 println!("\n🔧 Step 5: Direct XML parsing (advanced)...");
110
111 // You can also parse slide XML directly
112 let sample_xml = r#"<?xml version="1.0" encoding="UTF-8"?>
113 <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
114 xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
115 <p:cSld>
116 <p:spTree>
117 <p:sp>
118 <p:nvSpPr>
119 <p:cNvPr id="2" name="Title"/>
120 <p:nvPr><p:ph type="title"/></p:nvPr>
121 </p:nvSpPr>
122 <p:txBody>
123 <a:p>
124 <a:r>
125 <a:rPr b="1" sz="4400"/>
126 <a:t>Direct Parse Example</a:t>
127 </a:r>
128 </a:p>
129 </p:txBody>
130 </p:sp>
131 </p:spTree>
132 </p:cSld>
133 </p:sld>"#;
134
135 let parsed = SlideParser::parse(sample_xml)?;
136 println!(" Parsed XML directly:");
137 println!(" ├── Title: {}", parsed.title.as_deref().unwrap_or("(none)"));
138 println!(" └── Shapes: {}", parsed.shapes.len());
139
140 if let Some(shape) = parsed.shapes.first() {
141 if let Some(para) = shape.paragraphs.first() {
142 if let Some(run) = para.runs.first() {
143 println!("\n Text formatting detected:");
144 println!(" ├── Bold: {}", run.bold);
145 println!(" ├── Font size: {:?}", run.font_size);
146 println!(" └── Text: {}", run.text);
147 }
148 }
149 }
150
151 // Cleanup
152 fs::remove_file("sample_presentation.pptx").ok();
153
154 // =========================================================================
155 // Summary
156 // =========================================================================
157 println!("\n╔════════════════════════════════════════════════════════════╗");
158 println!("║ Demo Complete ║");
159 println!("╠════════════════════════════════════════════════════════════╣");
160 println!("║ Capabilities Demonstrated: ║");
161 println!("║ ✓ PresentationReader::open() - Open PPTX files ║");
162 println!("║ ✓ reader.info() - Get presentation metadata ║");
163 println!("║ ✓ reader.get_slide(i) - Parse individual slides ║");
164 println!("║ ✓ reader.extract_all_text() - Extract all text ║");
165 println!("║ ✓ SlideParser::parse() - Direct XML parsing ║");
166 println!("╚════════════════════════════════════════════════════════════╝");
167
168 Ok(())
169}Sourcepub fn get_all_slides(&self) -> Result<Vec<ParsedSlide>, PptxError>
pub fn get_all_slides(&self) -> Result<Vec<ParsedSlide>, PptxError>
Get all slides
Sourcepub fn extract_all_text(&self) -> Result<Vec<String>, PptxError>
pub fn extract_all_text(&self) -> Result<Vec<String>, PptxError>
Get all text from presentation
Examples found in repository?
examples/read_presentation.rs (line 97)
13fn main() -> Result<(), Box<dyn std::error::Error>> {
14 println!("╔════════════════════════════════════════════════════════════╗");
15 println!("║ PPTX Reading & Parsing Demo ║");
16 println!("╚════════════════════════════════════════════════════════════╝\n");
17
18 // =========================================================================
19 // Step 1: Create a sample PPTX to read
20 // =========================================================================
21 println!("📝 Step 1: Creating sample presentation...");
22
23 let slides = vec![
24 SlideContent::new("Welcome to PPTX-RS")
25 .layout(SlideLayout::CenteredTitle)
26 .title_bold(true)
27 .title_color("1F497D"),
28
29 SlideContent::new("Features Overview")
30 .add_bullet("Create presentations programmatically")
31 .add_bullet("Read existing PPTX files")
32 .add_bullet("Extract text and metadata")
33 .add_bullet("Parse shapes and tables"),
34
35 SlideContent::new("Technical Details")
36 .layout(SlideLayout::TwoColumn)
37 .add_bullet("XML parsing with xml-rs")
38 .add_bullet("ZIP handling with zip crate")
39 .add_bullet("ECMA-376 compliant")
40 .add_bullet("Rust 2024 edition")
41 .add_bullet("Cross-platform")
42 .add_bullet("No external dependencies"),
43
44 SlideContent::new("Summary")
45 .add_bullet("Full read/write support")
46 .add_bullet("Comprehensive API")
47 .add_bullet("Well tested"),
48 ];
49
50 let pptx_data = create_pptx_with_content("PPTX-RS Demo", slides)?;
51 fs::write("sample_presentation.pptx", &pptx_data)?;
52 println!(" ✓ Created sample_presentation.pptx ({} bytes)\n", pptx_data.len());
53
54 // =========================================================================
55 // Step 2: Open and read the presentation
56 // =========================================================================
57 println!("📖 Step 2: Opening presentation...");
58
59 let reader = PresentationReader::open("sample_presentation.pptx")?;
60 let info = reader.info();
61
62 println!(" Presentation Info:");
63 println!(" ├── Title: {}", info.title.as_deref().unwrap_or("(none)"));
64 println!(" ├── Creator: {}", info.creator.as_deref().unwrap_or("(none)"));
65 println!(" ├── Slides: {}", info.slide_count);
66 println!(" └── Revision: {}\n", info.revision.unwrap_or(0));
67
68 // =========================================================================
69 // Step 3: Parse each slide
70 // =========================================================================
71 println!("📑 Step 3: Parsing slides...");
72
73 for i in 0..reader.slide_count() {
74 let slide = reader.get_slide(i)?;
75
76 println!("\n Slide {}:", i + 1);
77 println!(" ├── Title: {}", slide.title.as_deref().unwrap_or("(none)"));
78 println!(" ├── Shapes: {}", slide.shapes.len());
79 println!(" ├── Tables: {}", slide.tables.len());
80
81 if !slide.body_text.is_empty() {
82 println!(" └── Body text:");
83 for (j, text) in slide.body_text.iter().enumerate() {
84 let prefix = if j == slide.body_text.len() - 1 { " └──" } else { " ├──" };
85 println!("{} {}", prefix, text);
86 }
87 } else {
88 println!(" └── Body text: (none)");
89 }
90 }
91
92 // =========================================================================
93 // Step 4: Extract all text
94 // =========================================================================
95 println!("\n📋 Step 4: Extracting all text...");
96
97 let all_text = reader.extract_all_text()?;
98 println!(" Found {} text items:", all_text.len());
99 for (i, text) in all_text.iter().take(10).enumerate() {
100 println!(" {}. {}", i + 1, text);
101 }
102 if all_text.len() > 10 {
103 println!(" ... and {} more", all_text.len() - 10);
104 }
105
106 // =========================================================================
107 // Step 5: Direct XML parsing (advanced)
108 // =========================================================================
109 println!("\n🔧 Step 5: Direct XML parsing (advanced)...");
110
111 // You can also parse slide XML directly
112 let sample_xml = r#"<?xml version="1.0" encoding="UTF-8"?>
113 <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
114 xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
115 <p:cSld>
116 <p:spTree>
117 <p:sp>
118 <p:nvSpPr>
119 <p:cNvPr id="2" name="Title"/>
120 <p:nvPr><p:ph type="title"/></p:nvPr>
121 </p:nvSpPr>
122 <p:txBody>
123 <a:p>
124 <a:r>
125 <a:rPr b="1" sz="4400"/>
126 <a:t>Direct Parse Example</a:t>
127 </a:r>
128 </a:p>
129 </p:txBody>
130 </p:sp>
131 </p:spTree>
132 </p:cSld>
133 </p:sld>"#;
134
135 let parsed = SlideParser::parse(sample_xml)?;
136 println!(" Parsed XML directly:");
137 println!(" ├── Title: {}", parsed.title.as_deref().unwrap_or("(none)"));
138 println!(" └── Shapes: {}", parsed.shapes.len());
139
140 if let Some(shape) = parsed.shapes.first() {
141 if let Some(para) = shape.paragraphs.first() {
142 if let Some(run) = para.runs.first() {
143 println!("\n Text formatting detected:");
144 println!(" ├── Bold: {}", run.bold);
145 println!(" ├── Font size: {:?}", run.font_size);
146 println!(" └── Text: {}", run.text);
147 }
148 }
149 }
150
151 // Cleanup
152 fs::remove_file("sample_presentation.pptx").ok();
153
154 // =========================================================================
155 // Summary
156 // =========================================================================
157 println!("\n╔════════════════════════════════════════════════════════════╗");
158 println!("║ Demo Complete ║");
159 println!("╠════════════════════════════════════════════════════════════╣");
160 println!("║ Capabilities Demonstrated: ║");
161 println!("║ ✓ PresentationReader::open() - Open PPTX files ║");
162 println!("║ ✓ reader.info() - Get presentation metadata ║");
163 println!("║ ✓ reader.get_slide(i) - Parse individual slides ║");
164 println!("║ ✓ reader.extract_all_text() - Extract all text ║");
165 println!("║ ✓ SlideParser::parse() - Direct XML parsing ║");
166 println!("╚════════════════════════════════════════════════════════════╝");
167
168 Ok(())
169}Auto Trait Implementations§
impl Freeze for PresentationReader
impl RefUnwindSafe for PresentationReader
impl Send for PresentationReader
impl Sync for PresentationReader
impl Unpin for PresentationReader
impl UnwindSafe for PresentationReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more