1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*!
# deckmint
Create PowerPoint `.pptx` presentations programmatically in Rust.
Works on native targets and compiles to WASM via the companion `deckmint-wasm` crate.
## Quick start
```rust,no_run
use deckmint::{Presentation, ShapeType};
use deckmint::objects::text::TextOptionsBuilder;
use deckmint::objects::shape::ShapeOptionsBuilder;
let mut pres = Presentation::new();
pres.title = "My Presentation".to_string();
let slide = pres.add_slide();
slide.add_text(
"Hello, World!",
TextOptionsBuilder::new()
.x(1.0).y(1.5).w(8.0).h(1.5)
.font_size(36.0)
.bold()
.build()
);
slide.add_shape(
ShapeType::Rect,
ShapeOptionsBuilder::new()
.x(1.0).y(3.0).w(4.0).h(2.0)
.fill_color("#4472C4")
.build()
);
let bytes = pres.write().expect("failed to generate pptx");
// bytes is a valid .pptx ZIP archive
```
## Tables
```rust,no_run
use deckmint::Presentation;
use deckmint::objects::table::{TableOptionsBuilder, TableCell};
let mut pres = Presentation::new();
let slide = pres.add_slide();
slide.add_table(
vec![
vec![TableCell::new("Name"), TableCell::new("Score")],
vec![TableCell::new("Alice"), TableCell::new("95")],
],
TableOptionsBuilder::new()
.x(1.0).y(1.5).w(8.0)
.col_w(vec![4.0, 4.0])
.font_size(14.0)
.build(),
);
```
## Charts
```rust,no_run
use deckmint::{Presentation, ChartType, ChartOptionsBuilder, ChartSeries};
let mut pres = Presentation::new();
let slide = pres.add_slide();
let series = vec![
ChartSeries::new("Q1", vec!["Jan", "Feb", "Mar"], vec![10.0, 20.0, 30.0]),
];
slide.add_chart(
ChartType::Bar,
series,
ChartOptionsBuilder::new()
.x(0.5).y(1.0).w(9.0).h(4.5)
.title("Monthly Sales")
.show_value()
.build(),
);
```
## Images
```rust,no_run
use deckmint::Presentation;
use deckmint::objects::image::ImageOptionsBuilder;
let png_bytes: Vec<u8> = std::fs::read("logo.png").unwrap();
let mut pres = Presentation::new();
let slide = pres.add_slide();
slide.add_image_from(
ImageOptionsBuilder::new()
.bytes(png_bytes, "png")
.bounds(3.0, 2.0, 4.0, 3.0)
).unwrap();
```
## Animations
```rust,no_run
use deckmint::{Presentation, AnimationEffect, Direction};
use deckmint::objects::text::TextOptionsBuilder;
let mut pres = Presentation::new();
let slide = pres.add_slide();
slide.add_text(
"I fly in!",
TextOptionsBuilder::new()
.x(1.0).y(2.0).w(8.0).h(1.5)
.animation(AnimationEffect::fly_in(Direction::Left))
.build(),
);
```
## Equations (requires `math` feature, enabled by default)
```rust,no_run
use deckmint::Presentation;
use deckmint::objects::text::TextOptionsBuilder;
let mut pres = Presentation::new();
let slide = pres.add_slide();
// Standalone equation
slide.add_equation(
r"x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}",
TextOptionsBuilder::new().bounds(1.0, 1.5, 8.0, 1.0).build(),
).unwrap();
// Inline math mixed with text (delimited by $...$)
slide.add_text_with_math(
r"The area of a circle is $A = \pi r^2$.",
TextOptionsBuilder::new().bounds(1.0, 3.0, 8.0, 1.0).font_size(18.0).build(),
).unwrap();
```
## Grid layout
The [`layout`] module provides a [`layout::GridLayoutBuilder`] for
arranging objects in rows and columns with gutters and padding.
## Output
- [`Presentation::write()`] returns `Vec<u8>` (the `.pptx` ZIP archive).
- [`Presentation::write_to_file(path)`](Presentation::write_to_file) writes directly to disk.
*/
// Re-exports for ergonomic top-level access
pub use ;
pub use PptxError;
pub use ;
pub use Slide;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;