XRCrossBandLine Class
A vertical line that can be drawn across several report bands.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Remarks
The XRCrossBandLine control allows you to draw a vertical line across several bands (as opposed to the XRLine, XRShape and XRPanel controls, which can be used only within a single band). You can use the XRCrossBandLine control to highlight a report section that spans across multiple bands.
Drag the XRCrossBandLine item from the DX.24.2: Report Controls tab and drop the item onto the report area to add a cross-band line to a report.
Place the control’s start and end in complementary bands that appear on each page of the document. The following bands are complementary:
- TopMarginBand and BottomMarginBand
- PageHeaderBand and PageFooterBand
- GroupHeaderBand and GroupFooterBand that have the RepeatEveryPage option enabled
In other cases, the control’s behavior can differ from an expected result. In the error list, an XRE040 warning message appears as you design or preview a report. For more information, review the following help topic: Errors, Warnings, and Information Messages.
Click the control’s smart tag to invoke the action list.
In the invoked action list, you can use the Line Style property to customize the line’s style, and the Anchor Vertical property to specify the type of vertical anchoring for the line.
Create a Cross-Band Line in Code
The following example creates a cross-band line in code:
using DevExpress.XtraReports.UI;
// Create a report with "Detail", "TopMargin", and "BottomMargin" bands.
XtraReport report = new XtraReport() {
Bands = {
new DetailBand(),
new TopMarginBand(),
new BottomMarginBand()
}
};
// Create a cross-band line.
XRCrossBandLine crossBandLine = new XRCrossBandLine() {
// Specify start/end bands.
StartBand = report.Bands[BandKind.TopMargin],
EndBand = report.Bands[BandKind.BottomMargin],
// Specify start/end points.
StartPointF = new DevExpress.Utils.PointFloat(0F, 0F),
EndPointF = new DevExpress.Utils.PointFloat(0F, 100F),
// Customize a style.
LineStyle = System.Drawing.Drawing2D.DashStyle.Dash,
WidthF = 5F,
};
// Add the line to the report's cross-band controls.
report.CrossBandControls.Add(crossBandLine);
Limitations
The Expression bindings mode is not supported. Although bindings are available, they are not processed and have no effect. To solve your task, handle the report’s BeforePrint event.
- If you do not place a cross-band line on paired bands, the line can be displayed incorrectly in the report document.
- A cross-band line cannot start/end on a vertical band.
If the thickness of a cross-band line is less than 0.5 pixels, the line is not included in export files that have the following formats:
- HTML, if ExportMode is set to SingleFile or SingleFilePageByPage and TableLayout is enabled.
- RTF, if ExportMode is set to SingleFile.
- DOCX, if ExportMode is set to SingleFile.
- DOCX, if ExportMode is set to SingleFilePageByPage and TableLayout is enabled.
- CSV.
- TXT.
- XLS and XLSX.
Setting
CanShrink
for a control that theXRCrossBandLine
control overlaps has no effect because theXRCrossBandLine
control does not shrink. In a table, consider using table borders instead of theXRCrossBandLine
control.