Back to Devexpress

XRTableRowCollection.FirstRow Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrtablerowcollection.md

latest4.0 KB
Original Source

XRTableRowCollection.FirstRow Property

Gets the first row in the collection of rows in the table.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public XRTableRow FirstRow { get; }
vb
Public ReadOnly Property FirstRow As XRTableRow

Property Value

TypeDescription
XRTableRow

An XRTableRow object occupying the uppermost position in the table.

|

Remarks

The first row in the collection of table rows is always located in the uppermost position in a table.

Example

The following code demonstrates different ways of inserting cells and columns into an XRTable control. The original table contains one column. The second column is created by adding two individual cells using the XRTableRow.InsertCell method. The third and fourth columns are added by the XRTable.InsertColumnToRight and XRTable.InsertColumnToLeft methods, correspondingly.

csharp
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public XRTable CreateTable() {
// Create an XRTable object containing two rows and one column.
    XRTable tab = XRTable.CreateTable(new Rectangle(200, 10, 200, 120), 2, 1);

    // Set the visible borders and their width for each table cell.
    tab.Borders = DevExpress.XtraPrinting.BorderSide.All;
    tab.BorderWidth = 2;

    // Create new cells.
    XRTableCell cell0 = new XRTableCell();
    XRTableCell cell1 = new XRTableCell();

    // Insert the new cells into the appropriate rows.
    tab.Rows.FirstRow.InsertCell(cell0, 0);
    tab.Rows.LastRow.InsertCell(cell1, 0);
    // The table has two columns now.

    // Insert a column to the right of the first row cell.
    tab.InsertColumnToRight(cell1);
    // The table has three columns now.

    // Insert a column to the left of the second row cell.
    tab.InsertColumnToLeft(cell1.NextCell);
    // The table has four columns now.

    return tab;
}
vb
Imports System.Drawing
Imports DevExpress.XtraReports.UI
' ...

Public Function CreateTable()
    ' Create an XRTable object containing two rows and one column.
    Dim tab As XRTable = XRTable.CreateTable(New Rectangle(200, 10, 200, 120), 2, 1)

    ' Set the visible borders and their width for each table cell.
    tab.Borders = DevExpress.XtraPrinting.BorderSide.All
    tab.BorderWidth = 2

    ' Create new cells.
    Dim cell0 As New XRTableCell()
    Dim cell1 As New XRTableCell()

    ' Insert the new cells into the appropriate rows.
    tab.Rows.FirstRow.InsertCell(cell0, 0)
    tab.Rows.LastRow.InsertCell(cell1, 0)
    ' The table has two columns now.

    ' Insert a column to the right of the first row cell.
    tab.InsertColumnToRight(cell1)
    ' The table has three columns now.

    ' Insert a column to the left of the second row cell.
    tab.InsertColumnToLeft(cell1.NextCell)
    ' The table has four columns now.

    Return tab
End Function

See Also

XRTableRowCollection Class

XRTableRowCollection Members

DevExpress.XtraReports.UI Namespace