Skip to main content Skip to footer

Make Decimal Point Formatting Consistent When Saving FlexGrid Data to a CSV File in Different Cultures


C1FlexGrid’s SaveGrid method changes the decimal separator according to region when saving grid data to a CSV file. For example. when saving grid data to a CSV file in ko culture, it looks like this:  3.2, 4.1, 33.2. While saving the same grid data to a CSV file in de culture, the file looks like this: "3,2","4,1","33,2".

To make the decimal point consistent across cultures, you must change the NumberDecimalSeparator of the NumberFormat in the current culture to a decimal point. This can be done with the following code:

CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);
CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator = ".";

Prabhat Sharma