Incorrect data when exporting time values to Excel... some times.
Hello,
I have a problem with the Excel export from time to time, the same report and as far as I can say, the same data (or kind of data).
The report includes 2 columns that have a Time value. When exporting to Excel, using the XLSXExport, some times the data arrives to export as "00/01/1900". For some other resultset of the same report, using the same parameters for the export and so on, the data is correct in Excel, for instance "7:00:30 a. m."
I haven't find what makes some results show as a date, without any time part, and some others as expected, just the time part.
I didn't use before the BIFF export, and the few tests I have made seem to be correct.
In any case, I would like to know why is that sometimes the same report/configuration show some incorrect values, and some others the correct values. Any idea?
Comments
Some corrections:
Send your report template (fr3) and prepared report (fp3) to support@fast-report.com
Ok. I will send the files by email.
Thanks!
hello
try
leave only checked as text
Thanks
Hello,
I'm still having this issue. I think I did not sent the files to the support email, as I did not have a reproducible case always. But now I think I do, and more, I think the problem is the changes made to the frxExportXLSX.pas file somewhere in the past, where around line 1012 you are checking if the DisplayFormat.Kind is a fkDateTime.
In that case, apparently, you are assuming the field will always have a date, and more than that, you are just converting the Date to int (StrDateToInt). But that will never work for times, as it is truncating the time part (at the end of the StrDatetoInt function). I haven't debugged this to see if it is in fact this, but sounds very likely.
The only way I have seen to workaround this is to change the Kind of the DisplayFormat to Text. But then I can't have the time fields in the format I need them, the text uses the one from the computer and that's not optimal in lots of cases.
I am on version 6.9.15.
Hello. I am not sure what you mean here? What property are we talking about?
Thanks!
I did some changes around the line I said, in frxExportXLSX: basically I check the DisplayFormat to see if there is any date-related characters, and if there is none (meaning, at least in my cases, that it's only a time), I skip the conversion. It smells like an ugly hack, but appears to work for my purposes.
I found this page because I experience the same problem. Has any patch been issued for this?
Regards