ooxml_wml/lib.rs
1//! WordprocessingML (DOCX) support for the ooxml library.
2//!
3//! This crate provides reading and writing of Word documents (.docx files).
4//!
5//! # Reading Documents
6//!
7//! ```ignore
8//! use ooxml_wml::Document;
9//! use ooxml_wml::ext::{BodyExt, ParagraphExt};
10//!
11//! let doc = Document::open("input.docx")?;
12//! for para in doc.body().paragraphs() {
13//! println!("{}", para.text());
14//! }
15//! ```
16//!
17//! # Creating Documents
18//!
19//! ```ignore
20//! use ooxml_wml::DocumentBuilder;
21//!
22//! let mut builder = DocumentBuilder::new();
23//! builder.add_paragraph("Hello, World!");
24//! builder.save("output.docx")?;
25//! ```
26
27pub mod convenience;
28pub mod document;
29pub mod error;
30pub mod ext;
31pub mod writer;
32
33/// Generated types from the ECMA-376 WordprocessingML schema.
34///
35/// These types map 1:1 to XML elements and attributes defined in ECMA-376 Part 1 §17.
36/// They are produced by `ooxml-codegen` from the RELAX NG schemas and committed to avoid
37/// requiring the schema files at build time. Use the extension traits in [`ext`] for
38/// ergonomic access rather than working with these types directly.
39///
40/// Re-exported as [`types`].
41#[allow(dead_code)]
42pub mod generated;
43/// Type aliases for the generated ECMA-376 types. See [`generated`] for details.
44pub use generated as types;
45
46/// Generated [`FromXml`](ooxml_xml::FromXml) parsers for all generated types.
47///
48/// Re-exported as [`parsers`].
49pub mod generated_parsers;
50/// Parsers for the generated ECMA-376 types. See [`generated_parsers`] for details.
51pub use generated_parsers as parsers;
52
53/// Generated [`ToXml`](ooxml_xml::ToXml) serializers for all generated types.
54///
55/// Re-exported as [`serializers`].
56pub mod generated_serializers;
57/// Serializers for the generated ECMA-376 types. See [`generated_serializers`] for details.
58pub use generated_serializers as serializers;
59
60// Metadata types from document.rs (OPC, not WML — not generated).
61pub use document::{AppProperties, CoreProperties, Document, DocumentSettings, ImageData};
62
63// Error types — always available.
64pub use error::{Error, ParseContext, Result, position_to_line_col};
65pub use ooxml_xml::{PositionedAttr, PositionedNode, RawXmlElement, RawXmlNode};
66
67// Writer types.
68pub use writer::{
69 AnchoredImage, CommentBuilder, DocumentBuilder, Drawing, EndnoteBuilder, FooterBuilder,
70 FootnoteBuilder, HeaderBuilder, HeaderFooterType, InlineImage, ListType, NumberingLevel,
71 TextBox, WrapType,
72};
73
74// Re-export commonly used generated types at the crate root.
75pub use types::ns;
76
77// Re-export MathZone from ooxml-omml for convenience.
78#[cfg(feature = "wml-math")]
79pub use ooxml_omml::MathZone;