One of our users notified us that the time column in the excel export of a grid wasn't displaying properly. I've never notice this before so I guess it's a new issue.
The TimeSpan in a column is exported as a number between 0 and 1 instead of a proper time format. The "Format Cell" option in Excel shows me that the column is exported as a "General" format. Once I put it on "Time" format the time displays properly. Has something changed within this ExportToXls method or has it always worked like this?
A small sample of what is exported to Excel:
Actienummer Startdatum Starttijd
4 10-10-2012 0,770833333
3 10-10-2012 0,770833333
9 12-9-2011 0,109027778
3 11-9-2011 0,935416667
5 9-9-2011 0,906944444
What can I do to get the export to show proper time formats (i.e. 't' or 'T' mask)?
Thanks,
Yoni
Hello Yoni,
I cannot replicate this issue on our side by using the attached sample project. Would you please modify this project or post your own so I can reproduce the issue? I will investigate it and try to find an appropriate solution.
Thanks,
Elliot
Hi Elliot.
I noticed that the problem is the fact that our TimeSpan is actually a nullable TimeSpan. This also goes for the DateTime as well. I've modified your sample to illustrate my issue.
Thanks,
Yoni
Thank you for your sample, Yoni. It seems strange that values are exported incorrectly only when the data source property is nullable, and I will inform our developers about this issue. We will let you know once we find the cause of the problem.