I'm using an external component called Gembox for creating Excel reports.
When exporting a property that's DateTime in C# towards Excel the value is in Excel shown as a number (for instance '-693593'). All other (basic) property types are displayed as the type the represent.
In Excel I would like a DateTime to be shown as a proper Date, in the Gembox options I could not find a option to set the format to Date.
Alternative option is to convert the DateTime with .ToString() while setting the value in Excel, this gives the desired result but is there a better way of doing so?
Some simplyfied code example:
ExcelFile excelFile = new ExcelFile();
ExcelWorksheet excelWorksheet = excelFile.Worksheets.Add("MyWorksheet");
int rownumber = 0;
int columnnumber = 2;
DateTime dateTime = DateTime.Now;
excelWorksheet.Cells[rownumber, columnnumber].Value = dateTime;
Example of output: