public void GetIndexOfTableElements()
{
Document doc = new Document(MyDir + "Table.Document.doc");
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
//ExStart
//ExFor:NodeCollection.IndexOf
//ExId:IndexOfTable
//ExSummary:Retrieves the index of a table in the document.
NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
int tableIndex = allTables.IndexOf(table);
//ExEnd
Row row = table.Rows[2];
//ExStart
//ExFor:Row
//ExFor:CompositeNode.IndexOf
//ExId:IndexOfRow
//ExSummary:Retrieves the index of a row in a table.
int rowIndex = table.IndexOf(row);
//ExEnd
Cell cell = row.LastCell;
//ExStart
//ExFor:Cell
//ExFor:CompositeNode.IndexOf
//ExId:IndexOfCell
//ExSummary:Retrieves the index of a cell in a row.
int cellIndex = row.IndexOf(cell);
//ExEnd
Assert.AreEqual(0, tableIndex);
Assert.AreEqual(2, rowIndex);
Assert.AreEqual(4, cellIndex);
}