About ooxmlsdk
Open XML is an open standard for word-processing documents, presentations, and spreadsheets. It was designed so applications can manipulate document data without depending on older proprietary binary formats or the original office application that created the file.
A .docx, .pptx, or .xlsx file is an Open Packaging Conventions package: a ZIP archive containing XML parts, binary parts, content types, and relationship files.
ooxmlsdk exposes that package structure through Rust types. You can open a package, navigate to strongly typed parts such as WordprocessingDocument, PresentationDocument, and SpreadsheetDocument, parse root XML elements into generated schema structs, modify those structs, and save the package again.
Package structure
An Open XML package contains:
[Content_Types].xml, which maps part names and extensions to content types.- Package-level relationships, usually in
_rels/.rels. - Document parts such as
word/document.xml,ppt/presentation.xml, orxl/workbook.xml. - Part-level relationships, such as
word/_rels/document.xml.rels. - Optional media, embedded objects, custom XML, comments, styles, charts, themes, and other package parts.
ooxmlsdk keeps these package concepts visible. The crate does not hide the file format behind a document-editor abstraction; instead, it gives you typed access to the package and schema model.
The ZIP container also gives package consumers random access to parts. For example, a tool can inspect a slide part without parsing every slide in the presentation, or remove a comments part from a word-processing package without reading all body paragraphs.
Document families
WordprocessingML packages are built around a required main document story. Optional stories and related parts can include:
- glossary document,
- headers and footers,
- comments,
- text boxes,
- footnotes and endnotes.
PresentationML packages can contain:
- slide masters,
- notes masters,
- handout masters,
- slide layouts,
- slides and notes.
SpreadsheetML packages can contain:
- a required workbook part,
- worksheets,
- charts,
- tables,
- custom XML,
- pivot caches and PivotTables.
Strongly typed Rust APIs
The runtime crate is generated from Open XML metadata. The generated surface includes:
- Package types in
ooxmlsdk::parts, behind thepartsfeature. - Schema structs and enums in
ooxmlsdk::schemas. - Shared package traits and settings in
ooxmlsdk::sdk. - Common package, relationship, XML, and error types in
ooxmlsdk::common. - Namespace constants and lookup helpers in
ooxmlsdk::namespaces. - Generated simple type support in
ooxmlsdk::simple_type. - OOXML measure and percentage helpers in
ooxmlsdk::units.
Most package operations return Result<_, ooxmlsdk::common::SdkError> or can be used with Box<dyn std::error::Error> in examples. Optional package relationships are represented with Option, and collections are exposed through Rust iterators or vectors depending on the generated schema shape.
In ooxmlsdk 0.10.2, generated schema fields use explicit simple value wrappers for OOXML booleans and typed unit values for many measures and percentages. Convert those values at the boundary of your application instead of assuming every schema attribute is a Rust bool, integer, or string.
Common tasks
ooxmlsdk supports the same broad task categories that matter when working with Open XML packages:
- Strongly typed package and schema access: use generated Rust types instead of hand-writing every element and attribute name.
- Content construction, search, and manipulation: traverse package relationships, inspect XML parts, load generated roots, and save updated packages. Use typed child accessors for well-known parts, or related-part traversal helpers when you need to keep the relationship id with the target part.
- Validation-oriented workflows: rely on explicit
Resulthandling plus package/schema tests, and enable the optionalvalidatorsfeature when you need structured schema diagnostics.
Feature model
In ooxmlsdk, the default feature set enables parts, which is what most users need for .docx, .xlsx, and .pptx package work.
Additional features are opt-in:
flat-opc: Flat OPC package read/write helpers.mce: Markup Compatibility and Extensibility processing.validators: optional validation APIs for generated schema roots and loaded package roots.
Use default-features = false when you want to make the enabled surface explicit.
Version coverage
The generated runtime uses Office 2007 as the compatibility baseline and includes newer OOXML namespaces and package relationships from later Office generations, including Office 2010, 2013, 2016, 2019, 2021, Microsoft 365-era additions, and newer upstream namespace revisions present in the checked-in metadata.
In practice this includes later DrawingML and chart extensions, SVG and 3D-related parts, threaded comments, dynamic-array-era spreadsheet extensions, and other post-2007 additions tracked by Open XML SDK metadata.
This means newer package parts and schema types are available from the Rust crate, but document validity still depends on the XML you construct and the target applications that will consume the file.