Skip to main content

Crate rusdox

Crate rusdox 

Source
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 .docx document containing paragraphs and tables.
DocumentMetadata
First-class document metadata used for DOCX package properties.
DocxTemplate
A DOCX package whose textual OOXML parts can be expanded from JSON data.
HeaderFooter
A simple header or footer paragraph template.
InputLimits
Resource ceilings applied to untrusted document, spec, and visual inputs.
PackageValidationReport
Structural OOXML package validation evidence.
PageNumbering
Page numbering configuration emitted into section properties.
PageSetup
Page setup values stored in OOXML twips.
Paragraph
A block-level text container made up of one or more runs.
ParagraphList
Semantic DOCX numbering metadata for a paragraph.
ParagraphStyle
A reusable paragraph style definition.
ParagraphStyleProperties
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.
RunStyleProperties
Run-level formatting that can participate in style inheritance.
Stylesheet
A collection of reusable paragraph, run, and table styles.
Table
A document table.
TableBorders
Border collection for tables and table cells.
TableCell
A table cell containing one or more paragraphs.
TableCellProperties
Properties attached to a table cell.
TableProperties
Properties attached to a table.
TableRow
A row in a table.
TableRowProperties
A row in a table.
TableStyle
A reusable table style definition.
TableStyleProperties
Table-level formatting that can participate in style inheritance.
TemplateDiagnostic
Actionable template diagnostic with an OOXML part and document location.
TemplateInspection
Machine-readable result of template inspect.
TemplatePlaceholder
One placeholder discovered in a Word-native template.
TemplateRenderReport
Machine-readable result of a Word-native template render.
Visual
A top-level visual block rendered as an image in DOCX and PDF output.
VisualSizing
Size constraints attached to a visual block.

Enums§

BorderStyle
A supported border style.
DocumentBlockRef
An ordered view of top-level document content.
DocumentMode
Controls how a document instance is intended to be used.
DocxError
Error variants returned by RusDox operations.
PageNumberFormat
Word page number formats exposed through the public API and spec.
PageOrientation
Physical page orientation shared by DOCX and PDF output.
ParagraphAlignment
Paragraph alignment options.
ParagraphListKind
Semantic paragraph list kinds supported by the DOCX writer.
RunField
Dynamic Word fields that also have a deterministic PDF fallback.
TemplateDiagnosticSeverity
Severity of a template inspection or render diagnostic.
UnderlineStyle
Supported underline styles for a text run.
VerticalAlign
Vertical alignment for a run.
VisualFormat
Supported on-disk or embedded visual formats.
VisualKind
The semantic role of a visual asset in the document.
VisualSource
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.