I have to read and write an excel file. The problem is that when a PC is the decimal separator, (comma) also in the excel file numbers with the comma will be saved. I would like to save the values for all modes with the point instead of a comma.
Here is a piece of code:
var wb = openWorkBook(filename);
var ws = wb.Worksheet("CNF");
IXLRow row = ws.Row(device.Ordinal - 1 + FirstRow);
for (int j = 0; j < MAXCOLS; ++j)
{
IXLCell cell = row.Cell(j + FirstCol);
cell.Value = Convert.ChangeType(device[j], m_column_type[j]);
}
Convert.ChangeType(object, Type)
uses the thread's current culture for conversion. It sounds like you want the invariant culture, so you should use Convert.ChangeType(object, Type, IFormatProvider)
:
cell.Value = Convert.ChangeType(device[j], m_column_type[j],
CultureInfo.InvariantCulture);
See more on this question at Stackoverflow