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
//! `office-toolkit` — facade crate for the toolkit.
//!
//! Single entry point re-exporting the public API of the format-specific crates, each behind its
//! own same-named Cargo feature — but all three enabled by `full`, which is also this crate's own
//! default. A plain `cargo add office-toolkit` compiles and works with zero configuration; the
//! features exist for anyone who wants to opt out of formats they don't use (smaller binary, faster
//! build), never as a requirement to get started. Simplicity for the common case was chosen
//! deliberately over "pay only for what you use by default".
//!
//! # Module layout
//!
//! - [`word`] — everything from `word_ooxml`, when the `word` feature is enabled (on by default).
//! - [`excel`] — everything from `excel_ooxml`, when the `excel` feature is enabled (on by
//! default).
//! - [`powerpoint`] — everything from `powerpoint_ooxml`, when the `powerpoint` feature is enabled
//! (on by default).
//! - [`drawing`]/[`chart`] — the two crates shared across all three formats (shape/text
//! formatting, embedded charts respectively) — always available, unconditionally, since every
//! format needs them to add an image, a shape, or a chart.
//! - [`prelude`] — the handful of types used constantly regardless of format
//! (`Document`/`Workbook`/`Presentation`, each format's most basic content-building type —
//! `Paragraph`/`Row`/`Slide` — plus the most common `drawing` types), re-exported unprefixed, so
//! `use office_toolkit::prelude::*;` alone is enough to start writing code.
//!
//! Everything deeper stays in its own namespaced module above — that namespacing isn't optional
//! there: several types (`DocumentProperties`, `Theme`, `ColorScheme`, `CustomPropertyValue`)
//! intentionally share the same name across two or three formats (kept consistent between them on
//! purpose), so re-exporting all of them flat at this crate's root would collide.
//!
//! [`open`] auto-detects a `.docx`/`.xlsx`/`.pptx` file's format from the package's own content
//! (not the file's name or extension) and returns a single [`OfficeDocument`];
//! [`OpenFile`]/[`SaveToFile`] add `open_file`/`save_to_file` methods directly on
//! `Document`/`Workbook`/`Presentation` for the more common case where the caller already knows
//! which format they're working with.
//!
//! # Example
//!
//! ```no_run
//! use office_toolkit::prelude::*;
//! use office_toolkit::SaveToFile;
//!
//! # fn main() -> office_toolkit::Result<()> {
//! // Build a minimal Word document and save it — `Document` and `Paragraph` both come straight
//! // from the prelude. `save_to_file` comes from the `SaveToFile` trait (see [`SaveToFile`]) —
//! // it has to be imported explicitly like any trait method, the prelude only covers types, not
//! // traits.
//! let document = Document::new().with_paragraph(Paragraph::with_text("Hello, world!"));
//! document.save_to_file("hello.docx")?;
//!
//! // Open any .docx/.xlsx/.pptx without knowing its format ahead of time.
//! let opened = office_toolkit::open("hello.docx")?;
//! opened.save_to_file("hello-resaved.docx")?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;