Introduction to Banded Reports
- 4 minutes to read
This topic describes the available report bands, explains their use, and illustrates how to add new bands to a report.
Understanding Report Bands
DevExpress reports follow a conventional banded report design advocated by Microsoft® Access® and adopted by many other report engines.
As opposed to WYSIWYG reports in which a designed report is no different from how it would look on paper, banded reports provide a generalized notion of a report layout that is different from how a published document looks in Print Preview.
Main Report Bands
Basically, a report layout consists of various bands that contain report controls and define their location on document pages. When you start with creating a blank report, it contains only the essential bands by default (the detail band for displaying recurring contents that comes from a report’s data source, along with the areas reserved for the top and bottom page margins).
The simplest examples of bands are page margins (repeated once on every document page) along with various headers and footers (repeated once for each page, group or an entire document).
The detail band differs both in its purpose (displaying recurring contents that comes from a report’s data source) and behavior (it is printed as many times, as there are records available in a data source unless you have filtered the incoming data). Every report must have a detail band and you cannot delete it.
Tip
Only the detail and group bands are used for displaying dynamic data source contents. Other headers and footers are commonly used to display various titles, summaries and customary information.
The following image illustrates a sample report layout along with the Report Explorer reflecting its structure:
Creating Subreports
Another special band kind is the detail report band. It enables you to create hierarchical master-detail reports that provide detail information about each record displayed in the master report’s detail band (such as orders shipped to each customer). You can create such reports when master-detail relationships are defined between data source tables:
In essence, a detail report band is a separate report (subreport) with its own data source, detail and other bands. A report can have any number of detail reports that can also be nested one into another.
Tip
You can display hierarchical information in a report in two different ways:
- by creating groups
- by using subreports
See Providing Data to Reports to learn how to choose the approach that best suits your data hierarchy.
The following image illustrates a master-detail report along with the Report Explorer reflecting its structure.
Tip
Detail report bands are serialized along with the main report’s layout, as opposed to subreports embedded by using the XRSubreport control.
Creating Band Copies
You can create functional copies of any band by adding sub-bands to it. This may be useful, for example, when you need a band to display different contents based on a specific condition.
Tip
See Laying Out Dynamic Report Contents to learn how you can control the location of bands’ content on document pages.
Managing Report Bands
Hiding and Removing Bands
You can collapse or expand a band in the Report Designer by clicking the arrow button located on the band’s title.
To remove a band along with all its content, select it on the report editing surface and press DELETE.
You can avoid printing a band’s content in a document by setting its Height to a zero value or its Visible property to false.
Adding Bands
Right-clicking a report’s design surface invokes a context menu containing various commands. The most commonly used commands enable you to add new bands to a report and clone existing bands by creating sub-bands.
You can insert a detail report if a report’s data source has any master-detail relations assigned to its tables.
Accessing the Collection of Bands
Click the Edit and Reorder Bands context link in a report’s smart tag to access the report’s collection of bands.
This command is also available in a smart tag of any band.
Tip
See Reporting API to learn about managing report bands at runtime.