I cannot display numbers when exporting to Excel in numeric format. First, all the numbers were exported in text format. Accordingly, when opening an eksel, all numbers were textual and eksel asked them to translate into numbers if desired.
I wrote a function that would check in what format the numbers in the database and if in the numeric then it left them so.
The problem is that the following integers become numeric, but with a comma, they remain textual, although they pass the test when debugging.
The function itself:
if (objDataType.Contains(TypeCode.Int32.ToString()) || objDataType.Contains(TypeCode.Int64.ToString()) || objDataType.Contains(TypeCode.Decimal.ToString()) || objDataType.Contains(TypeCode.Double.ToString()) || objDataType.Contains(TypeCode.Single.ToString())) { cell.DataType = new EnumValue<CellValues>(CellValues.Number); cell.CellValue = new CellValue(_table.Rows[i][j].ToString()); } else { cell.DataType = new EnumValue<CellValues>(CellValues.String); cell.CellValue = new CellValue(_table.Rows[i][j].ToString()); }