Guides · Architecture
Import a document
Opening a package admits it under explicit entry, path, size, and expansion limits, then produces a normalized model plus a compatibility report. Nothing is silently discarded.
use casual_doc_import::{import_package, ImportConfig, ImportMode};
use casual_doc_ooxml::{DocxPackage, PackageLimits};
let bytes = std::fs::read("document.docx")?;
let mut package = DocxPackage::open(&bytes, PackageLimits::default())?;
let outcome = import_package(
&mut package,
ImportConfig { mode: ImportMode::Semantic, ..ImportConfig::default() },
)?;
// `outcome.document` is the normalized model.
// Anything unmodeled lands in the compatibility report, not the void.
The admission limits and the package reader they guard are specified in docs/28 — the DOCX package reader; the host-facing import and transaction surfaces live in docs/05 — the SDK API spec.
Dispositions
Every construct the importer meets gets a disposition on two axes — whether the model represents it, and whether the original bytes are retained for write-back. The full rules are the disposition taxonomy.
Determinism
The same input, fonts, and engine version produce the same model, layout, and bytes — which is what makes rendering regression-testable.