Aspose.Words

Finding the Index of Table Elements

Finding the index of any node involves gathering all child nodes of the element’s type from the parent node then using the NodeCollection.IndexOf method to find the index of the desired node in the collection.

Finding the Index of Table in a Document

Example IndexOfTable

Retrieves the index of a table in the document.

[Java]

 

NodeCollection allTables = doc.getChildNodes(NodeType.TABLE, true);

int tableIndex = allTables.indexOf(table);

 

 

Finding the Index of a Row in a Table

Example IndexOfRow

Retrieves the index of a row in a table.

[Java]

 

int rowIndex = table.indexOf(row);

 

 

Finding the Index of a Cell in a Row

Example IndexOfCell

Retrieves the index of a cell in a row.

[Java]

 

int cellIndex = row.indexOf(cell);