Expand description
RusDox is a focused Rust library for building, reading, and saving
Microsoft Word .docx documents.
The crate models the document body with strongly typed paragraphs, runs, and tables while using fast ZIP and XML primitives internally.
§Example
use rusdox::{Document, Paragraph, Run};
let mut document = Document::new();
document.push_paragraph(
Paragraph::new()
.add_run(Run::from_text("Hello ").bold())
.add_run(Run::from_text("RusDox").italic()),
);
assert_eq!(document.paragraphs().count(), 1);Re-exports§
pub use batch::BatchItemResult;pub use batch::BatchLimits;pub use batch::BatchRenderer;pub use batch::BatchRequest;pub use batch::BatchStatus;pub use renderer::CancellationToken;pub use renderer::NativeRenderer;pub use renderer::RenderRequest;pub use renderer::RenderSource;pub use renderer::RenderedDocument;pub use renderer::Renderer;pub use renderer::RendererValidation;pub use renderer::SpecFormat;pub use renderer::RENDERER_API_VERSION;pub use schema::document_spec_schema;pub use schema::document_spec_schema_pretty;pub use schema::DOCUMENT_SPEC_SCHEMA_ID;pub use validate::validate_config;pub use validate::validate_spec;pub use validate::validate_spec_with_config;pub use validate::SourceSpan;pub use validate::ValidationIssue;pub use validate::ValidationReport;pub use validate::ValidationSeverity;
Modules§
- batch
- Bounded concurrent rendering for service and batch workloads.
- config
- Configuration model for RusDox document and preview generation.
- parity
- Machine-readable and human-readable evidence for DOCX/PDF parity checks.
- protocol
- Versioned local JSON protocol shared by stdin/stdout and loopback HTTP transports.
- renderer
- Stable, transport-neutral rendering boundary for Rust embedding and local protocols.
- schema
- Generated authoring schema for the versioned RusDox document spec.
- spec
- Versioned YAML, JSON, and TOML document specification types and builders.
- studio
- Configurable document composition and PDF preview helpers.
- validate
- Semantic validation diagnostics for document specifications and configuration.
Structs§
- Border
- A single table or cell border.
- Document
- A
.docxdocument containing paragraphs and tables. - Document
Metadata - First-class document metadata used for DOCX package properties.
- Docx
Template - A DOCX package whose textual OOXML parts can be expanded from JSON data.
- Header
Footer - A simple header or footer paragraph template.
- Input
Limits - Resource ceilings applied to untrusted document, spec, and visual inputs.
- Package
Validation Report - Structural OOXML package validation evidence.
- Page
Numbering - Page numbering configuration emitted into section properties.
- Page
Setup - Page setup values stored in OOXML twips.
- Paragraph
- A block-level text container made up of one or more runs.
- Paragraph
List - Semantic DOCX numbering metadata for a paragraph.
- Paragraph
Style - A reusable paragraph style definition.
- Paragraph
Style Properties - Paragraph-level formatting that can participate in style inheritance.
- Run
- An inline text fragment in a paragraph.
- RunProperties
- Typed formatting properties for a text run.
- RunStyle
- A reusable run style definition.
- RunStyle
Properties - Run-level formatting that can participate in style inheritance.
- Stylesheet
- A collection of reusable paragraph, run, and table styles.
- Table
- A document table.
- Table
Borders - Border collection for tables and table cells.
- Table
Cell - A table cell containing one or more paragraphs.
- Table
Cell Properties - Properties attached to a table cell.
- Table
Properties - Properties attached to a table.
- Table
Row - A row in a table.
- Table
RowProperties - A row in a table.
- Table
Style - A reusable table style definition.
- Table
Style Properties - Table-level formatting that can participate in style inheritance.
- Template
Diagnostic - Actionable template diagnostic with an OOXML part and document location.
- Template
Inspection - Machine-readable result of
template inspect. - Template
Placeholder - One placeholder discovered in a Word-native template.
- Template
Render Report - Machine-readable result of a Word-native template render.
- Visual
- A top-level visual block rendered as an image in DOCX and PDF output.
- Visual
Sizing - Size constraints attached to a visual block.
Enums§
- Border
Style - A supported border style.
- Document
Block Ref - An ordered view of top-level document content.
- Document
Mode - Controls how a document instance is intended to be used.
- Docx
Error - Error variants returned by RusDox operations.
- Page
Number Format - Word page number formats exposed through the public API and spec.
- Page
Orientation - Physical page orientation shared by DOCX and PDF output.
- Paragraph
Alignment - Paragraph alignment options.
- Paragraph
List Kind - Semantic paragraph list kinds supported by the DOCX writer.
- RunField
- Dynamic Word fields that also have a deterministic PDF fallback.
- Template
Diagnostic Severity - Severity of a template inspection or render diagnostic.
- Underline
Style - Supported underline styles for a text run.
- Vertical
Align - Vertical alignment for a run.
- Visual
Format - Supported on-disk or embedded visual formats.
- Visual
Kind - The semantic role of a visual asset in the document.
- Visual
Source - A visual source loaded from a file path or embedded directly in memory.
Constants§
- TEMPLATE_
SYNTAX_ VERSION - Current version of the Word-native placeholder contract.
Functions§
- atomic_
write_ file - Atomically replaces a file after fully writing and syncing a same-directory temporary file.
- attach_
source_ spans - Attaches best-effort line and column spans to semantic validation issues.
- attach_
source_ spans_ from_ str - Attaches spans from in-memory source text.
- validate_
docx_ package - Validates a DOCX package with the default resource ceilings.
- validate_
docx_ package_ with_ limits - Validates a DOCX package with explicit resource ceilings.
- validate_
docx_ reader_ with_ limits - Validates a seekable DOCX reader with explicit resource ceilings.
Type Aliases§
- Result
- The crate-wide result type used by RusDox.