UPDATE: Adds web app

This commit is contained in:
Nicolás Hatcher
2024-04-07 14:19:06 +02:00
parent b3b7dea930
commit a71eaf1dd7
115 changed files with 24728 additions and 49 deletions

View File

@@ -8,7 +8,7 @@
use std::path;
use ironcalc::{export::save_to_json, import::load_model_from_xlsx};
use ironcalc::{export::save_to_icalc, import::load_model_from_xlsx};
fn main() {
let args: Vec<_> = std::env::args().collect();
@@ -22,5 +22,5 @@ fn main() {
let base_name = file_path.file_stem().unwrap().to_str().unwrap();
let output_file_name = &format!("{base_name}.ic");
let model = load_model_from_xlsx(file_name, "en", "UTC").unwrap();
save_to_json(model.workbook, output_file_name);
save_to_icalc(model.workbook, output_file_name);
}

View File

@@ -129,9 +129,9 @@ pub fn save_xlsx_to_writer<W: Write + Seek>(model: &Model, writer: W) -> Result<
}
/// Exports an internal representation of a workbook into an equivalent IronCalc json format
pub fn save_to_json(workbook: Workbook, output: &str) {
let s = serde_json::to_string(&workbook).unwrap();
pub fn save_to_icalc(workbook: Workbook, output: &str) {
let s = bitcode::encode(&workbook);
let file_path = std::path::Path::new(output);
let mut file = fs::File::create(file_path).unwrap();
file.write_all(s.as_bytes()).unwrap();
file.write_all(&s).unwrap();
}