geoplex/openxmlutils

Not culture ignorant

Opened this issue · 1 comments

If using a culture with a decimal separator different from dot - e.g. Danish where the decimal separator is comma, the output file becomes corrupt and with missing decimal part for doubles.

excelerrormessage
result_dk_settings
result_us_settings
result_us_settings_dk_open

Simple work around: Change the culture to US English just before writing the file, and change it back after writing the file.

        var tmp = Thread.CurrentThread.CurrentCulture;
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
        Spreadsheet.Create(fileNameSections, sheetsSections);
        Spreadsheet.Create(fileNameDistresses, sheetsDistresses);
        Thread.CurrentThread.CurrentCulture = tmp;