Question

I'm using Delphi 2009 and I want to find index of HTML table which contains given element.

So, in the application, which I created, I use web browser to see the web page. I want to select element from this page and want to get Index of table which contains this element.

If someone can do it, please help me

Was it helpful?

Solution

Using the browser's DOM interfaces, locate the IHTMLElement interface of the desired HTML element as needed, then use its parentElement property to get its parent element, repeating as needed, until you find an element that supports the IHTMLTableCell interface. Its cellIndex property will tell you the index of the cell within its row. Keep iterating the parentElement chain until you find an element that supports the IHTMLTableRow interface. Its rowIndex property will tell you the index of the row within its table. If you need to access the table itself, keep iterating the parentElement chain until you find an element that supports the IHTMLTable interface.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top