Skip to main content

ooxml_opc/
lib.rs

1//! Core OOXML library: OPC packaging, relationships, and shared types.
2//!
3//! This crate provides the foundational types for working with Office Open XML files:
4//! - OPC (Open Packaging Conventions) - ZIP-based package format
5//! - Relationships - links between package parts
6//! - Content types - MIME type mappings
7//! - Core/App properties - document metadata
8//!
9//! Format-specific support is in separate crates:
10//! - `ooxml-wml` - WordprocessingML (DOCX)
11//! - `ooxml-sml` - SpreadsheetML (XLSX)
12//! - `ooxml-pml` - PresentationML (PPTX)
13//!
14//! # Example
15//!
16//! ```no_run
17//! use ooxml_opc::{Package, Relationships, rel_type, rels_path_for};
18//! use std::fs::File;
19//!
20//! let file = File::open("document.docx")?;
21//! let mut pkg = Package::open(file)?;
22//!
23//! // Read package relationships
24//! let rels_data = pkg.read_part("_rels/.rels")?;
25//! let rels = Relationships::parse(&rels_data[..])?;
26//!
27//! // Find the main document
28//! if let Some(doc_rel) = rels.get_by_type(rel_type::OFFICE_DOCUMENT) {
29//!     let doc_xml = pkg.read_part_string(&doc_rel.target)?;
30//!     println!("Document: {}", doc_xml);
31//! }
32//! # Ok::<(), ooxml_opc::Error>(())
33//! ```
34
35pub mod error;
36pub mod packaging;
37pub mod relationships;
38
39pub use error::{Error, Result};
40pub use packaging::{ContentTypes, Package, PackageWriter, content_type};
41pub use relationships::{Relationship, Relationships, TargetMode, rel_type, rels_path_for};