XRTableCell.RowSpan Property
Specifies the number of rows in the XRTable control that the cell spans.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v19.1.dll
NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Core
Declaration
[DefaultValue(1)]
[SRCategory(ReportStringId.CatBehavior)]
public int RowSpan { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Int32 | 1 | An integer value specifying the number of rows. |
Remarks
The RowSpan property allows you to specify the number of merged cells. For this property to work properly, a table should have a cell with the same width in the row below the current one.
You can also make a cell occupy several columns by specifying appropriate cell widths. The width of the target cell should be equal to the sum of the cells in the neighboring row.
Note
When using the RowSpan property, take note of the following limitations:
- New controls cannot be dropped onto the merged cells.
- The XRTableCell.CanGrow and XRTableCell.CanShrink properties have no effect on the merged cells.
Example
The following code demonstrates how to create a table with the layout shown in the image below.
using DevExpress.XtraReports.UI;
// ...
private XRTable CreateTable() {
XRTable table = new XRTable();
table.Borders = DevExpress.XtraPrinting.BorderSide.All;
table.BeginInit();
table.SizeF = new SizeF(400f, 50f);
XRTableRow row1 = new XRTableRow() { HeightF = 25f };
XRTableRow row2 = new XRTableRow() { HeightF = 25f };
row1.Cells.AddRange(new XRTableCell[] {
new XRTableCell() {Text = "Cell1", WidthF = 100f, RowSpan = 2},
new XRTableCell() {Text = "Cell2", WidthF = 100f},
new XRTableCell() {Text = "Cell3", WidthF = 200f}
});
row2.Cells.AddRange(new XRTableCell[] {
new XRTableCell() {WidthF = 100f},
new XRTableCell() {Text = "Cell4", WidthF = 100f},
new XRTableCell() {Text = "Cell5", WidthF = 100f},
new XRTableCell() {Text = "Cell6", WidthF = 100f}
});
table.Rows.AddRange(new XRTableRow[] { row1, row2 });
table.EndInit();
return table;
}