Report Bands

Each report consists of several sections (bands). Each band has its particular location, signification, dimension, and can contain components. The height of the band is based on the component’s dimension that it contains and can grow when the components are stretched.

../_images/bands.png
Examples
Quick usage:
1
2
3
4
 report()
 .title(cmp.text("This is a title band"))
 .pageHeader(cmp.text ("This is a page header band"))
 .pageFooter(cmp.text ("This is a page footer band"))

Another example: BandReport

A report contains these bands:

Title

The band is printed on the first page and only once.

Configuration options

# method description
1 titleOnANewPage() Prints the title band on a separate page
2 setTitleOnANewPage(Boolean titleOnANewPage) Sets whether or not the title band is printed on a separate page
3 setTitleSplitType(SplitType splitType)
Sets the title band split type
SplitType.PREVENT - prevents the band from splitting
SplitType.STRETCH - the band can be split, but never within its declared height.
SplitType.IMMEDIATE - the band can be split
4 setTitleStyle(StyleBuilder style) Sets a title band style
5
title(ComponentBuilder<?, ?> … comp),
addTitle(ComponentBuilder<?, ?> … comp)
Adds components to the title band

Column header

The band is printed on each page at the bottom of the page and it’s placed above the page footer band.

Configuration options

# method description
1
setColumnFooterSplitType(SplitType type)
Sets the column footer band split type
SplitType.PREVENT - prevents the band from splitting
SplitType.STRETCH - the band can be split, but never within its declared height.
SplitType.IMMEDIATE - the band can be split
2 floatColumnFooter() Prints the column footer band at the bottom of the column
3 setFloatColumnFooter(Boolean floatColFooter) Sets whether or not the column footer band is printed at the bottom of the column
4 setColumnFooterStyle(StyleBuilder style) Sets a column footer band style
5
columnFooter(ComponentBuilder<?, ?>
… components),
addColumnFooter(ComponentBuilder<?, ?>
… components)
Adds components to the column footer band

Group header

The band is printed for each data group. It’s placed above the grouped data and between the column header and footer.

# method description
1
setGroupHeaderSplitType(GroupBuilder<?>
grop, SplitType splitType)
Sets the group header band split type
SplitType.PREVENT - prevents the band from splitting
SplitType.STRETCH - the band can be split, but never within its declared height.
SplitType.IMMEDIATE - the band can be split
2
setGroupHeaderStyle(GroupBuilder<?> group,
StyleBuilder style)
Sets a group header band style
3
groupHeader(GroupBuilder<?> group,
ComponentBuilder<?, ?> … components),
addGroupHeader(GroupBuilder<?> group,
ComponentBuilder<?, ?> … components)
Adds components to the group header band

Detail

The band is printed for each record row in the data source and it’s placed between the column header and footer band.

Configuration options

# method description
1
setDetailSplitType(SplitType splitType)
Sets the detail band split type
SplitType.PREVENT - prevent band from splitting
SplitType.STRETCH - the band can be split, but
never within its declared height.
SplitType.IMMEDIATE - the band can be split
2 setDetailStyle(StyleBuilder style) Sets a detail band style
3
detail(ComponentBuilder<?, ?>
… components),
addDetail(ComponentBuilder<?, ?>
… components)
Adds components to the detail band

Detail header

The band is printed for each record row in the data source and it’s placed above the detail band.

Configuration options

# method description
1 setDetailHeaderSplitType(SplitType type)
Sets the detail header band split type
SplitType.PREVENT - prevent band from splitting
SplitType.STRETCH - the band can be split, but
never within its declared height.
SplitType.IMMEDIATE - the band can be split
2 setDetailHeaderStyle(StyleBuilder style) Sets a detail header band style
3
detailHeader(ComponentBuilder<?, ?>
… components),
addDetailHeader(ComponentBuilder<?, ?>
… components)
Adds components to the detail header band

Summary

The band is printed on the last page and only once.

Configuration options

# method description
1 summaryOnANewPage() Prints the summary band on a separate page
2 setSummaryOnANewPage(Boolean sumOnANewPage) Sets whether or not the summary band is printed on a separate page
3 summaryWithPageHeaderAndFooter() Prints the summary band with the page header and footer
4
setSummaryWithPageHeaderAndFooter(Boolean
summaryWithPageHeaderAndFooter)
Sets whether or not the summary band is printed
with the page header and footer
5 setSummarySplitType(SplitType splitType)
Sets the summary band split type
SplitType.PREVENT - prevents the band from splitting
SplitType.STRETCH - the band can be split, but never within its declared height.
SplitType.IMMEDIATE - the band can be split
6 setSummaryStyle(StyleBuilder style) Sets a summary band style
7
summary(ComponentBuilder<?, ?> … comps),
addSummary(ComponentBuilder<?, ?> … cos)
Adds components to the summary band

No data

The band is printed only when the data source is empty. It’s used to show the information that there are not any data in the report.

Configuration options

# method description
1 setNoDataStyle(StyleBuilder style) Sets a no data band style
2
noData(ComponentBuilder<?, ?> … comps),
addNoData(ComponentBuilder<?, ?> … comp)
Adds components to the no data band

Background

The band is printed on each page. It’s mostly used for adding watermarks to the report.

Configuration options

# method description
1 setBackgroundStyle(StyleBuilder style) Sets a background band style
2
background(ComponentBuilder<?, ?> … co),
addBackground(ComponentBuilder<?, ?>
… components)
Adds components to the background band

Tags: layout