Hello,
If I start up Excel (I'm using 2013), type a date value into a cell (For instance 11-Sep-16), then save it as XLSX and look at the cell with
XLS.Sheets[FActiveSheet].IsDateTime[FCol, FRow]
then it IsDateTime returns true as expected.
However, if I save the Excel file as XLS, using the "Microsoft Excel 5.0/95 Workbook" format, then IsDateTime returns false. The newer XLS formats work OK.
I know that there is an easy workaround, but is it possible to fix this?
Thanks,
John
Dates in Excel 5.0/95
Re: Dates in Excel 5.0/95
Hello
As a date/time cell is a floating point cell formatted to present the value as a date/time you can check the cells NumberFormat value to see if it looks like a date/time. Excel 97 and Excel 2007 normally uses the system format for date/time and this is how XLSReadWrite knows if a cell is a date/time value. I don't remember if this is true for Excel 95.
As a date/time cell is a floating point cell formatted to present the value as a date/time you can check the cells NumberFormat value to see if it looks like a date/time. Excel 97 and Excel 2007 normally uses the system format for date/time and this is how XLSReadWrite knows if a cell is a date/time value. I don't remember if this is true for Excel 95.
Lars Arvidsson, Axolot Data
Re: Dates in Excel 5.0/95
It looks like that is what you are doing in TXLSWorksheet.GetIsDateTime. You check NumFmt.Value, but when I step through this code, the problem is that the NumFmt is blank.
I have an old VM that I started up today with an older version of our app that Used XLSReadWriteII4. I tested with the same XLS file, I put a breakpoint in TSheet.GetIsDateTime and saw that the NumberFormat was correct there ('dd\-mmm\-yy') and GetIsDateTime returned true. So it seems that Number Formats in Excel 5.0/95 files aren't being loaded correctly by XLSReadWriteII5.
I have an old VM that I started up today with an older version of our app that Used XLSReadWriteII4. I tested with the same XLS file, I put a breakpoint in TSheet.GetIsDateTime and saw that the NumberFormat was correct there ('dd\-mmm\-yy') and GetIsDateTime returned true. So it seems that Number Formats in Excel 5.0/95 files aren't being loaded correctly by XLSReadWriteII5.