I export data from datagried to excel and one column with numbers is with error 'numbers stored as text'. I am trying to convert them using following code, but its not working. Could you suggest?
Microsoft.Office.Interop.Excel.Range rangeOfValues = worksheet.Range["E5", "E5"].EntireColumn;
rangeOfValues.Cells.NumberFormat = "# ##0,00";
rangeOfValues.Value = rangeOfValues.Value;
I also tried this code, but then column headers are moved up and data is broken.
worksheet.Range["E5", "E5"].EntireColumn.TextToColumns();
worksheet.Columns[5].NumberFormat = "# ##0,00";