xl3_core/lib.rs
1//! xl3-core — pure-Rust XLSX template rendering engine.
2//!
3//! Reads an Excel template plus a data workbook, evaluates the XTL
4//! expressions inside template cells, and emits a rendered XLSX
5//! buffer. This is the same engine that powers the `xl3-wasm` npm
6//! package; it can also be embedded directly in Rust CLIs, Tauri
7//! desktop apps, or server-side batch jobs.
8//!
9//! # Quick start
10//!
11//! ```no_run
12//! use xl3_core::render_from_bytes_to_files;
13//!
14//! let template = std::fs::read("template.xlsx").unwrap();
15//! let data = std::fs::read("data.xlsx").unwrap();
16//! let files = render_from_bytes_to_files(&template, &data).unwrap();
17//! std::fs::write(&files[0].filename, &files[0].data).unwrap();
18//! ```
19//!
20//! # Pipeline
21//!
22//! 1. [`plan`] — parse the template workbook + `__config__` sheet
23//! into a [`WorkbookPlan`] of static and expansion rows.
24//! 2. [`source`] — read the data workbook into row records.
25//! 3. [`render`] — walk the plan, evaluating each cell through
26//! [`eval`], and emit cells through [`output`].
27//!
28//! See the parent repository's `PLAN.md` for the broader roadmap.
29
30pub mod directives;
31pub mod errors;
32pub mod eval;
33pub mod functions;
34pub mod introspect;
35pub mod manifest;
36pub mod output;
37pub mod output_model;
38pub mod plan;
39pub mod render;
40pub mod source;
41pub mod styles;
42pub mod value;
43
44pub use calamine;
45pub use rust_xlsxwriter;
46
47pub use errors::{is_xtl_error, XtlError};
48pub use introspect::{
49 preview, preview_bytes, read_template_inputs, read_template_inputs_bytes, InputKind,
50 InputSpec, PreviewFile, PreviewResult, PreviewSheet, PreviewSource,
51};
52pub use manifest::{
53 AlignmentSpec, ColumnWidth, FillPattern, FillSpec, FontSpec, HorizontalAlign,
54 StyleManifest, StyleSpec, VerticalAlign,
55};
56pub use output_model::{OutputFile, XtlWarning};
57pub use plan::{parse_template, parse_template_bytes, CellSource, RowPlan, SheetPlan, WorkbookPlan};
58pub use render::{
59 render, render_from_bytes_to_files, render_from_bytes_to_files_full,
60 render_from_bytes_to_files_with_inputs, render_to_files,
61};
62pub use source::{CalamineSourceReader, SourceData, SourceReader};
63pub use value::Value;