NodeCollectionIndexOf Method |
Returns the zero-based index of the specified node.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic int IndexOf(
Node node
)
Public Function IndexOf (
node As Node
) As Integer
public:
int IndexOf(
Node^ node
)
member IndexOf :
node : Node -> int
Parameters
- node
- Type: Aspose.WordsNode
The node to locate.
Return Value
Type:
Int32The zero-based index of the node within the collection, if found; otherwise, -1.
RemarksThis method performs a linear search; therefore, the average execution time is proportional to Count.
ExamplesRetrieves the index of a table in the document.
NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
int tableIndex = allTables.IndexOf(table);
Row row = table.Rows[2];
int rowIndex = table.IndexOf(row);
Cell cell = row.LastCell;
int cellIndex = row.IndexOf(cell);
See Also