Page 1 of 1

Dates in Excel 5.0/95

Posted: Thu Sep 29, 2016 1:08 pm
by jdorlon
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

Re: Dates in Excel 5.0/95

Posted: Sun Oct 02, 2016 7:11 pm
by larsa
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.

Re: Dates in Excel 5.0/95

Posted: Tue Oct 04, 2016 9:37 pm
by jdorlon
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.