ExcelDataReader.GetNumberFormatString returns wrong value
See original GitHub issueWhen reading the format of a cell with Short Date Format, Excel returns the format according to the system configuration, but GetNumberFormatString
returns always as “d/m/yyyy”
In Excel it says m/d/yyyy
:
In Code it returns d/m/yyyy
:
Issue Analytics
- State:
- Created 4 years ago
- Comments:16
Top Results From Across the Web
how to keep the datetimeformat of excel.cell into dataset cell
ExcelDataReader loses Excel's formatting information when using AsDataSet() , which basically gives you only the raw values.
Read more >LinRaise/ExcelDataReader
GetNumberFormatString () returns a string containing the formatting codes for a value in the current row, or null if there is no value....
Read more >ExcelDataReader
GetNumberFormatString () returns a string containing the formatting codes for a value in the current row, or null if there is no value....
Read more >How to read excel data with formatted values in C#... - ...
GetValue(columnIndex); var formatString = reader.GetNumberFormatString(columnIndex); if (formatString == null) return Convert.ToString(value ...
Read more >ExcelDataReader
ExcelDataReader.GetNumberFormatString returns wrong value $ 0. Created 3 years ago in ExcelDataReader/ExcelDataReader with 16 comments. When reading the format ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It can be done, but it requires work. LinqToExcel simply uses Excel itself to do the work via its OLEDB provider.
ExcelDataReader is completely standalone and does not rely on Excel.
I think recent versions of Excel only ever uses a built-in format 14, at least for western locales, in all other cases it explicitly includes the format string in the file. So it depends on what the source is for the files you want to validate and how thorough you want to be.
14 as far as I know matches the short date format in Windows.
If you need to handle more cases then look at BuiltinNumberFormat.cs to try and figure out what the culture specific variant of the built-in format index is, I believe the hardcoded ones there are en-us. If you also need to support Asian cultures then look at #541 where we’ve started to figure that stuff out.