Skip to main content

Crate ravenrs_report_export

Crate ravenrs_report_export 

Source
Expand description

One way to turn a report [Document] into a file. The editor, the server and any other module call this, so a report exports the same from anywhere.

use ravenrs_report::{Band, Control, Report, ReportEngine};
use ravenrs_report_export::{ExportFormat, export};
use serde_json::json;

let report = Report::new("Vendas").detail(Band::new(18.0).control(Control::field("[N]").at(0.0, 0.0, 200.0, 18.0)));
let document = ReportEngine::new().render(&report, &json!([{ "N": "Ana" }]));
let file = export(&document, ExportFormat::Pdf, Some("2026-11-01"))?;
assert_eq!(file.name, "Vendas 2026-11-01.pdf");
assert_eq!(file.mime, "application/pdf");

Structs§

ExportedFile
A file ready to be saved or sent.

Enums§

ExportFormat
A format a document can be exported to.

Functions§

export
Writes document in format. suffix, such as a date, goes after the title in the name.
file_name
A title as a file name, keeping accents and dropping what file systems refuse.