We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

CSV and decimal separator

Hi,


I have a couple of questions about the decimal separator used when saving to CSV:

- Is it always “.” or it depends on the separator specified into the system?
- Is it possible to force a specific separator ("." or “,”)?

Thanks
Max

Hi,

Thanks for using Aspose.Cells.

To change the decimal separator for formatting cells and saving csv, please see following code:

C#


Workbook wb…

CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.LCID, true);

ci.NumberFormat.NumberDecimalSeparator = “,”;

wb.Settings.CultureInfo = ci;

wb.Save(“e:/download/res.csv”);


Or you can just change the cultureinfo/region to existing one whose default decimal separator is the character your desired:

C#
Workbook wb...
wb.Settings.Region = CountryCode.Germany; //the default decimal separator is ‘,'
wb.Save("e:/download/res.csv");