Expand description
Core OOXML library: OPC packaging, relationships, and shared types.
This crate provides the foundational types for working with Office Open XML files:
- OPC (Open Packaging Conventions) - ZIP-based package format
- Relationships - links between package parts
- Content types - MIME type mappings
- Core/App properties - document metadata
Format-specific support is in separate crates:
ooxml-wml- WordprocessingML (DOCX)ooxml-sml- SpreadsheetML (XLSX)ooxml-pml- PresentationML (PPTX)
§Example
use ooxml_opc::{Package, Relationships, rel_type, rels_path_for};
use std::fs::File;
let file = File::open("document.docx")?;
let mut pkg = Package::open(file)?;
// Read package relationships
let rels_data = pkg.read_part("_rels/.rels")?;
let rels = Relationships::parse(&rels_data[..])?;
// Find the main document
if let Some(doc_rel) = rels.get_by_type(rel_type::OFFICE_DOCUMENT) {
let doc_xml = pkg.read_part_string(&doc_rel.target)?;
println!("Document: {}", doc_xml);
}Re-exports§
pub use error::Error;pub use error::Result;pub use packaging::ContentTypes;pub use packaging::Package;pub use packaging::PackageWriter;pub use packaging::content_type;pub use relationships::Relationship;pub use relationships::Relationships;pub use relationships::TargetMode;pub use relationships::rel_type;pub use relationships::rels_path_for;
Modules§
- error
- Error types for the ooxml crate.
- packaging
- OPC (Open Packaging Conventions) implementation.
- relationships
- Relationships handling for OPC packages.