How to work with Excel Tables? I need to find if any in the sheet and to get its region.

In Excel OLE this is: XLApp.ActiveWorkbook.ActiveSheet.ListObjects[1].Range

Thank you!

How to work with Excel Tables? I need to find if any in the sheet and to get its region.

In Excel OLE this is: XLApp.ActiveWorkbook.ActiveSheet.ListObjects[1].Range

Thank you!

Hi,

The code should be something like this:

for (int i = 1; i <= xlsFile.TableCountInSheet; i++)

{

var table = xlsFile.GetTable(i);

DoSomething(table.Range);

}

I was actually writing you an email about it right now, but I will then just post it here.

Sorry, I've just realized that I mixed languages: This is FlexCle for Delphi, not C#. This is the corresponding code in Delphi:

var

...

i: integer;

table: ITableDefinition;

begin

...

for i := 1 to xls.TableCountInSheet do

begin

table := xls.GetTable(i);

DoSomething(table.Range);

end;

end.