umya-spreadsheet
umya-spreadsheet copied to clipboard
Writing NaN results in a corrupted spreadsheet
Writing NaN using set_value will result in a corrupted spreadsheet
` let path = Path::new("test.xlsx"); let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap();
let sheet = book.get_sheet_mut(&0).unwrap();
sheet.get_cell_mut((1,7))
.set_value("NaN");
umya_spreadsheet::writer::xlsx::write(&book, path).unwrap();`
This is because set_value tries to write this as a number (which feels like it should be supported) but ultimately results in a corruption warning when opening Excel.
I am currently not sure whether:
- NaN in a numeric cell is not supported by Excel
- NaN is supported but has been incorrectly implemented here
A temporary work around is to use set_value_string instead.
Permanent solutions:
- Correctly implement NaN as a number cellvalue
- set_value should correctly determine that the cell should be a string
@Niatross Thank you for your report. We will address this in the next update.
Fixed a bug. Please get the latest version.