Expand description
xl3-core — pure-Rust XLSX template rendering engine.
Reads an Excel template plus a data workbook, evaluates the XTL
expressions inside template cells, and emits a rendered XLSX
buffer. This is the same engine that powers the xl3-wasm npm
package; it can also be embedded directly in Rust CLIs, Tauri
desktop apps, or server-side batch jobs.
§Quick start
use xl3_core::render_from_bytes_to_files;
let template = std::fs::read("template.xlsx").unwrap();
let data = std::fs::read("data.xlsx").unwrap();
let files = render_from_bytes_to_files(&template, &data).unwrap();
std::fs::write(&files[0].filename, &files[0].data).unwrap();§Pipeline
plan— parse the template workbook +__config__sheet into aWorkbookPlanof static and expansion rows.source— read the data workbook into row records.- [
render] — walk the plan, evaluating each cell througheval, and emit cells throughoutput.
See the parent repository’s PLAN.md for the broader roadmap.
Re-exports§
pub use errors::is_xtl_error;pub use errors::XtlError;pub use introspect::preview;pub use introspect::preview_bytes;pub use introspect::read_template_inputs;pub use introspect::read_template_inputs_bytes;pub use introspect::InputKind;pub use introspect::InputSpec;pub use introspect::PreviewFile;pub use introspect::PreviewResult;pub use introspect::PreviewSheet;pub use introspect::PreviewSource;pub use manifest::AlignmentSpec;pub use manifest::ColumnWidth;pub use manifest::FillPattern;pub use manifest::FillSpec;pub use manifest::FontSpec;pub use manifest::HorizontalAlign;pub use manifest::StyleManifest;pub use manifest::StyleSpec;pub use manifest::VerticalAlign;pub use output_model::OutputFile;pub use output_model::XtlWarning;pub use plan::parse_template;pub use plan::parse_template_bytes;pub use plan::CellSource;pub use plan::RowPlan;pub use plan::SheetPlan;pub use plan::WorkbookPlan;pub use render::render;pub use render::render_from_bytes_to_files;pub use render::render_from_bytes_to_files_full;pub use render::render_from_bytes_to_files_with_inputs;pub use render::render_to_files;pub use source::CalamineSourceReader;pub use source::SourceData;pub use source::SourceReader;pub use value::Value;pub use calamine;pub use rust_xlsxwriter;
Modules§
- directives
- Directive parsing.
- errors
- Stable error-code surface, mirroring xl3 (TS)’s
XtlError/xtlError/isXtlError(ADR-0015) and xl3-py’sXtlError. - eval
- Expression parser + evaluator for XTL templates.
- functions
- Context-free scalar function implementations.
- introspect
- Surface-area parity with xl3 (TS) / xl3-py introspection APIs.
- manifest
- Style manifest model exchanged with the JS shell.
- output
- Output buffer assembly.
- output_
model - Public output types — mirror the TS / Python sibling APIs so that
xl3-wasmand any other host can return the sameOutputFile[]shape thatconvert()produces in xl3 (TS) and xl3-py. - plan
- Template plan: the parsed, evaluation-ready representation of a template workbook.
- render
- Top-level renderer. Glues
plan+source+eval+output. - source
- Source data reader. Reads the data workbook (
data.xlsx) into row records keyed by the header row. - styles
- Parse the bits of a template workbook that calamine doesn’t expose:
the
xl/styles.xmlnumFmt / cellXfs tables, and each worksheet’s cell-levels="<xf>"attribute. We need this for ADR-0003 numFmt cell coercion ({{ [Amount] }}in a numeric-format cell yields a Number, not the source string). - value
- Cell value representation used by the planner, source reader, and evaluator. Deliberately simple — strings, numbers, booleans, plus an explicit Empty so we can distinguish “blank cell” from “empty string”.