Skip to main content

XRTableRow.SetCellRange(XRTableCell[]) Method

Replaces the existing collection of cells in the row with an array of XRTableCell objects.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public void SetCellRange(
    params XRTableCell[] cells
)

Parameters

Name Type Description
cells XRTableCell[]

An array of XRTableCell objects that will replace the existing collection of cells in the row.

Example

The following example demonstrates how to use the XRTableRow.SetCellRange method to set an array of table cells to a table row at runtime. The following methods create a row containing three cells, and replaces them with a collection of four cells returned by the CreateArrayOfCells method.

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

public XRTableRow CreateRow() {
    // Create a table row.
    XRTableRow row = XRTableRow.CreateRow(new SizeF(300F, 50F), 3);

    // Make borders of all cells in a row visible, and set their width.
    row.Borders = DevExpress.XtraPrinting.BorderSide.All;
    row.BorderWidth = 2;

    // Replace row cells with an array of 4 cells.
    row.SetCellRange(CreateArrayOfCells(4));

    return row;
}

public XRTableCell[] CreateArrayOfCells(int number){
    // Create an array of table cells.
    XRTableCell[] cellCollection = new XRTableCell[4];

    // Initialize cell objects and set the cells background color.
    for (int i = 0; i < cellCollection.Length; i++) {
        cellCollection[i] = new XRTableCell();
        cellCollection[i].BackColor = Color.Aqua;
    }

    return cellCollection;
}
See Also