Skip to main content

ooxml_omml/
lib.rs

1//! Office Math Markup Language (OMML) support for the ooxml library.
2//!
3//! This crate provides types and parsing for mathematical formulas
4//! in Word, Excel, and PowerPoint documents.
5//!
6//! # Example
7//!
8//! ```
9//! use ooxml_omml::{MathZone, parse_math_zone};
10//!
11//! let xml = r#"<m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
12//!     <m:f>
13//!         <m:num><m:r><m:t>1</m:t></m:r></m:num>
14//!         <m:den><m:r><m:t>2</m:t></m:r></m:den>
15//!     </m:f>
16//! </m:oMath>"#;
17//!
18//! let zone = parse_math_zone(xml.as_bytes()).unwrap();
19//! assert_eq!(zone.text(), "(1)/(2)");
20//! ```
21//!
22//! # Supported Elements
23//!
24//! - Fractions (`m:f`)
25//! - Radicals (`m:rad`)
26//! - N-ary operators like summation and integrals (`m:nary`)
27//! - Subscripts and superscripts (`m:sSub`, `m:sSup`, `m:sSubSup`)
28//! - Delimiters/parentheses (`m:d`)
29//! - Matrices (`m:m`)
30//! - Functions (`m:func`)
31//! - Accents (`m:acc`)
32//! - And more...
33
34pub mod error;
35pub mod ext;
36pub mod math;
37
38pub use error::{Error, Result};
39pub use math::{
40    Accent, Bar, BorderBox, Delimiter, EquationArray, Fraction, FractionType, Function, GroupChar,
41    Limit, LimitLocation, MathBox, MathElement, MathRun, MathRunProperties, MathScript, MathStyle,
42    MathZone, Matrix, Nary, Phantom, PreScript, Radical, Script, SubSuperscript, VerticalPosition,
43    parse_math_zone, parse_math_zone_from_reader, serialize_math_zone,
44};