diff --git a/examples/test.csv b/examples/test.csv
deleted file mode 100644
index ca1b615..0000000
--- a/examples/test.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-pi,3^5,"ref(0,0)",-(1/0)
-12%5,"pow(3,5)",0/NaN,"""Apollo"""
-A1+A2,"if(true , sqrt(25),round(if(false,1.1,2.5)))",D2+1969,
diff --git a/examples/test.xlsx b/examples/test.xlsx
new file mode 100644
index 0000000..714870d
Binary files /dev/null and b/examples/test.xlsx differ
diff --git a/src/book/mod.rs b/src/book/mod.rs
index a691930..abf5d75 100644
--- a/src/book/mod.rs
+++ b/src/book/mod.rs
@@ -7,7 +7,7 @@ use ironcalc::{
worksheet::WorksheetDimension,
Model,
},
- export::save_to_xlsx,
+ export::save_xlsx_to_writer,
import::load_from_xlsx,
};
@@ -51,7 +51,11 @@ impl Book {
/// Save book to an xlsx file.
pub fn save_to_xlsx(&self, path: &str) -> Result<()> {
- save_to_xlsx(&self.model, path)?;
+ // TODO(zaphar): Currently overwrites. Should we prompty in this case?
+ let file_path = std::path::Path::new(path);
+ let file = std::fs::File::create(file_path)?;
+ let writer = std::io::BufWriter::new(file);
+ save_xlsx_to_writer(&self.model, writer)?;
Ok(())
}
diff --git a/src/ui/mod.rs b/src/ui/mod.rs
index 9044a02..5f01b6c 100644
--- a/src/ui/mod.rs
+++ b/src/ui/mod.rs
@@ -156,14 +156,9 @@ impl<'ws> Workspace<'ws> {
fn handle_edit_input(&mut self, key: event::KeyEvent) -> Result