NanoXLSX
NanoXLSX copied to clipboard
Content corrupted on Worksheet rename
Hi Rabanti,
I just catch an other weird bug. If I rename a worksheet with this code:
string Filename = @"C:\_Local\Sample.xlsx"; Workbook Wb = Workbook.Load(Filename); Wb.GetWorksheet("Sheet1").SetSheetName("NewSheetName"); Wb.Filename = Filename; Wb.Save();
I get the dates corrupted.
Before:

After:

Hi, What is your system locale, where the library is running? Other than "en-US"? I have a suspicion. I discovered some other instances in the reader code, where numbers are not parsed with enforced neutral Locale. I will post a patched package version for testing purpose
Hi, can you quickly try the attached NuGet package out? This should fix any I18N-parsing issue. If it is working, I will do some maintenance work and then release the patch ASAP. Thank you in advance Debug.zip
It works!

my locale is "es-ES"
By the way, why renaming the worksheet has I18N issues? is the data "copied" to a new sheet instead of the sheet renamed?
Hi, It was not an issue of renaming but of parsing numbers when reading and then saving the file again. The dates are internally stored as floats (OADate, starting at 1900-01-01). .NET is parsing such numbers and also date/time representations - if not stated other - in the current locale of the running computer. Therefore it may mess up decimal points and number separators. Same applies to ToString, by the way. I thought I have already eliminated all of the unspecified parser code, but there were still parts in the reader remaining. Maybe I integrate localization unit tests.
I will release the patched version soon. Thank you for testing the preview.
Hi, Sorry for the waiting time. Was battling with the Java version of the library. The Release v2.0.4 should now also fix the problem described above. The NuGet package should be available in some minutes.
Thanks again for the reports and the testing. I really appreciate this, since it helps to raise the quality of NanoXLSX. Pleas do not hesitate to open another issue, if something is not working as expected.
I will close this issue for now. Please do not hesitate to re-open or file a new one, if further problems occur. Once again, thank you very much for the report and testing