I am redoing a project with Delphi 7 and an XLSX file. I connect to the file using ADO. This works fine, and I can get the data just perfectly, and fast.
My problem is that somehow I always get sheet names from ADO in a sorted list.
So, I can have these 3 sheets in my Excel file:
[MySheet1] [Blad1] [Ark1]
(0) (1) (2) <<< sheet ID number, zero-based
When I connect to Excel, and send the command:
excelcon.GetTableNames(lstSheets.Items,false);
I always get them in sorted order, like this:
Ark1$
Blad1$
Mysheet1$
The listbox I use to display names is of course not with "sorted" property.
Is there any way using ADO to ask for sheet numbers specifically ("what is name of sheet 0").. looping over the sheets.
NOTE Some others have pointed a tip for C++ to order by int ordinalPosition. ("ORDINAL_POSITION"). I am not too sure how to do that in Delphi.