I have an Excel file that is generated from an SQL db, through an OpenXML request.
All fields are exported as strings.

Depending on the customer's configuration, sometimes the decimal separator is a comma, sometimes a point.

When the Excel file is first open, some code runs to clean and normalize the data, especially to convert numbers and dates properly.
I check for the local decimal separator (from the regional settings) and replace whatever separator is used in the file with it.

This is where I have a problem.

Let's assume my separator is a comma.
If the file already has commas, then it's fine, nothing changes.
If it's a point, sometimes it works, sometimes not.

If the number I want to convert has 2,3,4 decimals, it converts fine.
More than that and it goes crazy.

A number like 32.12345678 will be converted to 3212345678 (the point is not replaced, it is even removed!)
The same number but 32.12 will be converted to 32,12 just fine.

This is driving me crazy. By the way I used the replace function to change the string in complete ranges, much faster.

Any help is appreciated!!