Closed tmp64 closed 4 months ago
If the system is configured to use decimal separator different from a dot (.), Excel converter parses floats incorrectly.
.
Source Excel:
Converted JSON:
I narrowed this down to a ToString call in ExcelSheetConverter.Page.GetCell:
ToString
ExcelSheetConverter.Page.GetCell
Debugger console: _table.Rows[row][col] 0.29999999999999999 _table.Rows[row][col].ToString() "0,3"
I fixed it like this. Don't know if that's the only place to fix though.
public string GetCell(int col, int row) { if (col >= _table.Columns.Count || row >= _table.Rows.Count) return null; if (_table.Rows[row][col] is IConvertible conv) return conv.ToString(CultureInfo.InvariantCulture); else return _table.Rows[row][col].ToString(); }
My regional settings for reference:
Thank you for reporting! This should've been accounted with https://github.com/cathei/BakingSheet/issues/12, but I overlooked it.
Fixed in v4.1.3
Thanks for fixing and releasing so quickly!
If the system is configured to use decimal separator different from a dot (
.
), Excel converter parses floats incorrectly.Source Excel:
Converted JSON:
I narrowed this down to a
ToString
call inExcelSheetConverter.Page.GetCell
:I fixed it like this. Don't know if that's the only place to fix though.
My regional settings for reference: