Bug description
I have xlsx exported from Google sheet. It failed to load in NanoXLSX with
FormatException: Input string was not in a correct format.
Good that I have access to source and be able to pinpoint the line.
The xlsx sheet has frozen pane, and from tracing your source code, the library wont be able to handle when "ySplit" = "1.0"
The lib helper function ReaderUtils.ParseInt
inside is calling
int.Parse( rawValue, CultureInfo.InvariantCulture )
which is equivalent to
int.Parse( rawValue, NumberStyles.Integer, CultureInfo.InvariantCulture )
passing "1.0" make this call throws "FormatException"
Steps To Reproduce
Steps to reproduce the behavior:
- Go to google sheet link in the attachment section. Export it as XLSX to your PC.
- Use NanoXLSX to load this xlsx.
- I got FormatException
Sample Code
Just Workbook.Load( Filename );
Expected behavior
I guess this is trivial value formatting problem?
Changing inside of ReaderUtils.ParseInt to call to int.Parse( rawValue, NumberStyles.Any, CultureInfo.InvariantCulture )
would also make this pass.
But that was just my naive guess, I don't have in-depth knowledge of XLSX standard, idk if that would break any other compatibility.
Screenshots and/or attachments
Screenshot is above
Sample sheet is here
https://docs.google.com/spreadsheets/d/1H1fRjvA16enlCLTG17RdTXHgHV6rif-bFkAQhGDTda8/edit?usp=sharing
Environment (please complete the following information):
- OS: win11
- .NET framework: This was on Unity3D C# project, it has equivalent of .NET Framework 4.8 (see next section)
- Your system locale: en-US
- Version of NanoXLSX: Lastest github commit as of 2024/Jan/22
Additional context
The code environment was ran on Unity3D C# project, which is using its own .NET implementation (Mono)
But I guess this should not make this problem unique to UnityC# (?)
The int.Parse( rawValue, CultureInfo.InvariantCulture )
and int.Parse( rawValue, NumberStyles.Integer, CultureInfo.InvariantCulture )
part behaviour should be identical to offical .NET nonetheless.