My application needs to read and process data from xlsx files, which are made according to a specified format (which is out of my control).
The first row is empty, the second row has column names, and data start on the third row.
So, after loading the WorkBook and getting the Worksheet I try to iterate through data:
for I := 2 to WorkSheet.Rows.Count - 1 do // the data start on the third row.
begin
// read cells and process data
end
However, it fails -- no data are processed.
I found that WorkSheet.Rows.Count returns 1, so the loop is never executed.
However, when I open the file in Excell or Libre Office, I see that there are many more rows.
The attached zip file contains the simple test application and simple Test.xlsx file (saved in the application folder).
Please try the application -- the WorkSheet.Rows.Count returns 1, but reading cells with bigger row indexes gives correct values!
Lazarus 2.0.3-fixes, FPC 3.0.4, FPSpreadSheet trunk rev. 7018, Windows 7 32-bit