Skip to main content
A newer version of this page is available. .

XRTableCell.Weight Property

Specifies the relative size of the XRTableCell in respect to the sizes of other cells in a row.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v17.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[Browsable(false)]
public double Weight { get; set; }

Property Value

Type Description
Double

A Double value.

Remarks

When creating large tables in code, you can increase the report generator performance by setting the Weight property to 1 for all table cells.

Example

The following example illustrates the best approach to create large tables in code, which uses the XRTableCell.Weight and XRTableRow.Weight properties to specify the cell size (instead of using the XRTableCell.WidthF and XRTableRow.WidthF properties that are better suited for creating smaller tables).

The table generation occurs within the XRTable.BeginInit and XRTable.EndInit method calls.

using DevExpress.XtraReports.UI;
// ...

private XRTable CreateLargeTable(int rowCount, int cellCount) {
    XRTable table = new XRTable();
    table.BeginInit();
    for (int i = 0; i < rowCount; i++) {
        XRTableRow row = new XRTableRow() { Weight = 1 };
        for (int j = 0; j < cellCount; j++) {
            XRTableCell cell = new XRTableCell() { Weight = 1 };
            row.Cells.Add(cell);
        }
        table.Rows.Add(row);
    }
    table.EndInit();

    return table;
}
See Also