All docs
V19.2
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GroupHeaderBand.PrintAcrossBands Property

Gets or sets whether this band is printed as the background layer across all other bands that belong to the same group.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.2.dll

Declaration

[Browsable(true)]
public override bool PrintAcrossBands { get; set; }
<Browsable(True)>
Public Overrides Property PrintAcrossBands As Boolean

Property Value

Type Description
Boolean

true, if this band is printed as the background layer across all other bands that belong to the same group; otherwise, false.

Remarks

Enable the PrintAcrossBands property if you need to:

  • Display continuous content side-by-side with bands that belong to the same group – headers, detail, and footers.

    Provide margins for the content to avoid overlapped elements.

    print-across-bands

  • Create a custom watermark for a group, if the XRWatermark control does not cover your needs.

    Export into table formats (for instance, export into Excel spreadsheets) does not work correctly in this case. To disable export for the controls in the cross-band content, set their CanPublish property to false.

If the cross-band content does not reach the group's bottom, the content is not stretched nor repeated.

Display Cross-Band Content and Group Headers

Use one of the following methods:

  • Add an outer GroupHeaderBand that includes cross-band content, and an inner GroupHeaderBand that includes group headers. Specify group field(s) in the outer band. Enable the outer band's PrintAcrossBands property.
  • Add a GroupHeaderBand that includes cross-band content, add a SubBand to the GroupHeaderBand. Place headers on the SubBand. Enable the GroupHeaderBand's PrintAcrossBands property.

    print-across-bands

    As an alternative, place the cross-band content on the SubBand and enable the SubBand's PrintAcrossBands property to print the cross-band content below the GroupHeaderBand. Set the GroupHeaderBand's PrintAcrossBands property to false. See SubBand.PrintAcrossBands for details.

Cases when the PrintAcrossBands Value is Ignored

This property is not available in a VerticalHeaderBand.

Set PrintAcrossBands in the Designer

Click the GroupHeaderBand's smart tag and check the Print Across Bands property.

smarttag

The band's icon indicates if the band is printed across other group bands:

PrintAcrossBands = false

PrintAcrossBands = true

print-across-bands-groupheader-1

print-across-bands-groupheader-2

Tip

See the Create a Report with Cross-Band Content and Populated Empty Space topic for information on how you can use the PrintAcrossBands property to create a band that is printed across the report's other content.

Runtime Example

The code sample below illustrates how to add content that shows group information (the Order ID) and is printed across the DetailBand and GroupFooterBand. The report is bound to the OrderDetailsExtended view from the sample Northwind database that is shipped with the XtraReports installation.

groupheaderband-printacrossbands-preview

using System.Drawing;
using System.Drawing.Printing;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting;
// ...
public static XtraReport CreateReportWithGroupHeader() {
    // Create an XtraReport instance.
    XtraReport report = new XtraReport() {
        Name = "Invoice",
        DisplayName = "Invoice",
        PaperKind = PaperKind.Letter,
        Margins = new Margins(100, 100, 100, 100)
    };

    // Create a GroupHeader band.
    GroupHeaderBand groupHeaderBand = new GroupHeaderBand() {
        HeightF = 25,
        PrintAcrossBands = true,
    };
    groupHeaderBand.GroupFields.Add(new GroupField("OrderID"));

    // Create a Detail band for the report.
    DetailBand detailBand = new DetailBand() {
        HeightF = 25,
    };

    // Create a GroupFooter band.
    GroupFooterBand groupFooterBand = new GroupFooterBand() {
        HeightF = 25,
    };

    // Add the created bands to the report.
    report.Bands.AddRange(new Band[] { groupHeaderBand, detailBand, groupFooterBand });

    // Create report controls.
    XRLabel lbOrderId = new XRLabel() {
        Font = new Font("Tahoma", 16f, FontStyle.Bold),
        TextAlignment = TextAlignment.TopCenter,
        ForeColor = Color.White,
        BackColor = Color.SteelBlue,
        BoundsF = new RectangleF(0, 1, 200, 200),
        TextFormatString = "Order ID: {0}",
    };
    XRLabel lbProductName = new XRLabel() {
        Font = new Font("Tahoma", 10f, FontStyle.Regular),
        BoundsF = new RectangleF(250, 0, 200, 25),
    };
    XRLabel lbQuantity = new XRLabel() {
        TextAlignment = TextAlignment.MiddleRight,
        Font = new Font("Tahoma", 10f, FontStyle.Regular),
        BoundsF = new RectangleF(550, 0, 100, 25),
    };
    XRLabel lbUnitPrice = new XRLabel() {
        TextAlignment = TextAlignment.MiddleRight,
        Font = new Font("Tahoma", 10f, FontStyle.Regular),
        BoundsF = new RectangleF(450, 0, 100, 25),
        TextFormatString = "{0:$0.00}",
    };
    XRLabel lbTotal = new XRLabel() {
        Font = new Font("Tahoma", 14f, FontStyle.Bold),
        TextAlignment = TextAlignment.MiddleRight,
        BoundsF = new RectangleF(450, 0, 200, 25),
        TextFormatString = "Total: {0:$0.00}",
    };

    // Configure the controls' expression bindings and summary settings.
    lbOrderId.ExpressionBindings.Add(new ExpressionBinding("Text", "[OrderID]"));
    lbOrderId.Summary.Running = SummaryRunning.Group;
    lbProductName.ExpressionBindings.Add(new ExpressionBinding("Text", "[ProductName]"));
    lbQuantity.ExpressionBindings.Add(new ExpressionBinding("Text", "[Quantity]"));
    lbUnitPrice.ExpressionBindings.Add(new ExpressionBinding("Text", "[UnitPrice]"));
    lbTotal.ExpressionBindings.Add(new ExpressionBinding("Text", "sumSum([ExtendedPrice])"));
    lbTotal.Summary.Running = SummaryRunning.Group;

    // Add the created controls to the bands.
    groupHeaderBand.Controls.Add(lbOrderId);
    detailBand.Controls.AddRange(new XRControl[] { lbQuantity, lbProductName, lbUnitPrice });
    groupFooterBand.Controls.Add(lbTotal);

    // Return the resulting report.
    return report;
}
See Also