TableFirstRow Property

Returns the first Row node in the table.

Namespace:  Aspose.Words.Tables
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Row FirstRow { get; }

Property Value

Type: Row
Examples
Shows how to use typed properties to access nodes of the document tree.
// Quick typed access to the first child Section node of the Document
Section section = doc.FirstSection;

// Quick typed access to the Body child node of the Section
Body body = section.Body;

// Quick typed access to all Table child nodes contained in the Body
TableCollection tables = body.Tables;

foreach (Table table in tables.OfType<Table>())
{
    // Quick typed access to the first row of the table
    table.FirstRow?.Remove();

    // Quick typed access to the last row of the table
    table.LastRow?.Remove();
}
Examples
Shows how to combine the rows from two tables into one.
// Load the document
Document doc = new Document(MyDir + "Tables.docx");

// Get the first and second table in the document
// The rows from the second table will be appended to the end of the first table
Table firstTable = (Table) doc.GetChild(NodeType.Table, 0, true);
Table secondTable = (Table) doc.GetChild(NodeType.Table, 1, true);

// Append all rows from the current table to the next
// Due to the design of tables even tables with different cell count and widths can be joined into one table
while (secondTable.HasChildNodes)
    firstTable.Rows.Add(secondTable.FirstRow);

// Remove the empty table container
secondTable.Remove();

doc.Save(ArtifactsDir + "Table.CombineTables.doc");
See Also