0

I am trying to store the value "10,23" in an Excel file using the ClosedXML Library but the value inserted is "1023".

The code I have is:

XLWorkbook workbook = new XLWorkbook();
IXLWorksheet worksheet = workbook.Worksheets.Add("sheet1");
worksheet.Cell(0, 0).Value = "10,23";
workbook.SaveAs("c:\temp\file.xlsx");
Patrick
  • 2,995
  • 14
  • 64
  • 125

2 Answers2

1

After a lot of testing, I found the solution for the problem:

XLWorkbook workbook = new XLWorkbook();
IXLWorksheet worksheet = workbook.Worksheets.Add("sheet1");
worksheet.Cell(0, 0).Value = "'10,23";  // <-- Insert the symbol ' before the value
workbook.SaveAs("c:\temp\file.xlsx");

The solution is to insert the symbol ' before the value

Patrick
  • 2,995
  • 14
  • 64
  • 125
0

try replacing "10,23" with "10.23".

P.

  • Hi, thanks. I tried but it did not work. In the the minetime I found a solution, let me share it. – Patrick May 18 '16 at 16:21