Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.2.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