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

Free Support Forum - aspose.com

Dot transformed in Comma by ExportDataTableAsString method?

Hello,

We extract data from Excel files using the ExportDataTableAsString method.

In a general way, it seems that values are correctly extracted from file. But, sometimes, dot decimal marks are transformed in comma separator by the function. It’s critical for our application.

Could you have a check on it and explain me if the problem comes from the function or the input file?

Thanks for your help.

MNT21335.zip (117.6 KB)

@LaurentToulouse,

Thanks for the template file.

Well, it might be due to your regional settings/locale of your system where you are performing this operation/code. What is your locale or regional settings of the OS where you are running the application? Also, could you open the template file into MS Excel on the system to check if you see decimal dots are replaced with commas for the values. Please provide us a simple console application (you may zip it prior attaching here) to show the issue. Also give us some screenshots (e.g taken when viewing the template Excel file into MS Excel on the machine where you are executing the code segment) to trace the issue. This will help us really to evaluate your issue precisely to consequently figure it out soon.

Hi Amjad_Sahi,

Thanks for your help.
We work for an international company, so all the platforms (client/server) are in English.

However, after several tests with a console tool, we conclude that original XLS file has been produced by a user in a french environment, that’s why the function returns comma instead of dot digital mark.

If we apply the following code line, It seems that the returned values will be correctly transformed :
wkBook.Settings.Region = CountryCode.UnitedKingdom

Do you think it’s a good fix? Do you think that this implementation is only required for XLS files treatment? Not XLSX? I have read that ASPOSE retrieve locale from OS for XLSX files treatment? Is it right?

Thanks for your help

@LaurentToulouse,

Good to know that you found the root cause of your issue and figures your issue out.

You have done right to set the region before exporting to data table. Even you may think to try:
e.g
Sample code:

.......
`wkBook.Settings.Region = CountryCode.France;`
........

but again if using wkBook.Settings.Region = CountryCode.UnitedKingdom works for your desired needs, you should use it only.

Moreover, I think you should set the region for both XLS and XLSX file formats, it would suit your needs well.