fsprojects / ExcelProvider

This library is for the .NET platform implementing a Excel type provider.
http://fsprojects.github.io/ExcelProvider/
The Unlicense
141 stars 51 forks source link

Culture Info setting #35

Open isaacabraham opened 7 years ago

isaacabraham commented 7 years ago

Is there any way (or plans) to allow setting Globalization settings when reading sheets? If you use ForceString = true, it appears to return the data in the OS culture, rather than the current culture of the app domain that's been set. This causes problems downstream if you then do any parsing operations.

magnushammar commented 5 years ago

This one bit me today. My expectation from ForceString was that I would get the same exact string that I see in Excel. If I have the characters 12,34 in Excel I don't expect to get the string "12.34", its not the same sequence of characters. 😄

A very real problem is also that the behavior will change depending on the cell format. I am certain that this would have haunted me in the future if I hadn't noticed it today.

English USA OS with Swedish Regional Settings Excel format: General 12(comma)34 --> "12(dot)34" Excel format: Text 12(comma)34 --> "12(comma)34"

waynebx commented 5 years ago

I guess it has something to do with using the string operator to convert values to String. string operator will attempt to use InvariantCulture instead of the current culture if the input can be casted to IFormattable