2

I have been using ClosedXML to write and create sheets in an excel file.

I am running into an issue, on systems that have non-US locales.

Instead of writing three hundred point four-one as 300.41 ClosedXML is writing this decimal number as 300,41.

How do I make it write Decimal numbers with decimal point always?

I am using “InsertData()” function to write all the data from a List<> of objects into the excel sheet.

Thanks in advance.

I would really like to write decimal numbers in the excel for non-US locales with decimal point instead of decimal comma.

  • 1
    Are the values that you submit to ClosedXML of string or a numeric type (decimal, double, single)? If the latter, then that would be a bug in ClosedXML. If the former, you should change the format before submitting the value. – 500 - Internal Server Error Feb 23 '23 at 21:38
  • 1
    The applied format will change according to the culture of the machine. Have you tried changing the current culture? – hijinxbassist Feb 23 '23 at 22:35
  • Hello @500-InternalServerError the values are of double type. – destroyer 38 Feb 24 '23 at 02:29
  • Hello @hijinxbassist, how do I properly change the current culture can you please help me with the code, since I am using “InsertData()” function, thabks – destroyer 38 Feb 24 '23 at 02:31
  • Then you should report this to the authors of ClosedXML. An XML document that uses anything other than a decimal point in numbers is not following the XML specification - it should not matter what the application's input/output locale happens to be. – 500 - Internal Server Error Feb 24 '23 at 08:00

0 Answers0