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.
Report bands
Examples
Quick usage:

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

methoddescription
titleOnANewPage() Prints the title band on a separate page
setTitleOnANewPage(Boolean titleOnANewPage) Sets whether or not the title band is printed on a separate page
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
setTitleStyle(StyleBuilder style) Sets a title band style
title(ComponentBuilder<?, ?> ... components),
addTitle(ComponentBuilder<?, ?> ... components)
Adds components to the title band

Page header

The band is printed on each page at the top of the page.
Configuration options

methoddescription
setPageHeaderSplitType(SplitType splitType) Sets the page 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
setPageHeaderStyle(StyleBuilder style) Sets a page header band style
pageHeader(ComponentBuilder<?, ?> ... components),
addPageHeader(ComponentBuilder<?, ?> ... components)
Adds components to the page header band

Page footer

The band is printed on each page at the bottom of the page.
Configuration options

methoddescription
setPageFooterSplitType(SplitType splitType) Sets the page 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
setPageFooterStyle(StyleBuilder style) Sets a page footer band style
pageFooter(ComponentBuilder<?, ?> ... components),
addPageFooter(ComponentBuilder<?, ?> ... components)
Adds components to the page footer band

Column header

The band is printed on each page at the top of the page and it's placed below the page header band.
Configuration options

methoddescription
setColumnHeaderSplitType(SplitType splitType) Sets the column 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
setColumnHeaderStyle(StyleBuilder style) Sets a column header band style
columnHeader(ComponentBuilder<?, ?> ... components),
addColumnHeader(ComponentBuilder<?, ?> ... components)
Adds components to the column header band

Column footer

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

methoddescription
setColumnFooterSplitType(SplitType splitType) 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
floatColumnFooter() Prints the column footer band at the bottom of the column
setFloatColumnFooter(Boolean floatColumnFooter) Sets whether or not the column footer band is printed at the bottom of the column
setColumnFooterStyle(StyleBuilder style) Sets a column footer band style
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.

methoddescription
setGroupHeaderSplitType(GroupBuilder<?> group, 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
setGroupHeaderStyle(GroupBuilder<?> group, StyleBuilder style) Sets a group header band style
groupHeader(GroupBuilder<?> group, ComponentBuilder<?, ?> ... components),
addGroupHeader(GroupBuilder<?> group, ComponentBuilder<?, ?> ... components)
Adds components to the group header band

Group footer

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

methoddescription
setGroupFooterSplitType(GroupBuilder<?> group, SplitType splitType) Sets the group 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
setGroupFooterStyle(GroupBuilder<?> group, StyleBuilder style) Sets a group footer band style
groupFooter(GroupBuilder<?> group, ComponentBuilder<?, ?> ... components),
addGroupFooter(GroupBuilder<?> group, ComponentBuilder<?, ?> ... components)
Adds components to the group footer 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

methoddescription
setDetailSplitType(SplitType splitType) Sets the detail 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
setDetailStyle(StyleBuilder style) Sets a detail band style
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

methoddescription
setDetailHeaderSplitType(SplitType splitType) Sets the detail 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
setDetailHeaderStyle(StyleBuilder style) Sets a detail header band style
detailHeader(ComponentBuilder<?, ?> ... components),
addDetailHeader(ComponentBuilder<?, ?> ... components)
Adds components to the detail header band

Detail footer

The band is printed for each record row in the data source and it's placed below the detail band.
Configuration options

methoddescription
setDetailFooterSplitType(SplitType splitType) Sets the detail 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
setDetailFooterStyle(StyleBuilder style) Sets a detail footer band style
detailFooter(ComponentBuilder<?, ?> ... components),
addDetailFooter(ComponentBuilder<?, ?> ... components)
Adds components to the detail footer band

Last page footer

The band is printed only on the last page at the bottom of the page.
Configuration options

methoddescription
setLastPageFooterSplitType(SplitType splitType) Sets the last page 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
setLastPageFooterStyle(StyleBuilder style) Sets a last page footer band style
lastPageFooter(ComponentBuilder<?, ?> ... components),
addLastPageFooter(ComponentBuilder<?, ?> ... components)
Adds components to the last page footer band

Summary

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

methoddescription
summaryOnANewPage() Prints the summary band on a separate page
setSummaryOnANewPage(Boolean summaryOnANewPage) Sets whether or not the summary band is printed on a separate page
summaryWithPageHeaderAndFooter() Prints the summary band with the page header and footer
setSummaryWithPageHeaderAndFooter(Boolean summaryWithPageHeaderAndFooter) Sets whether or not the summary band is printed with the page header and footer
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
setSummaryStyle(StyleBuilder style) Sets a summary band style
summary(ComponentBuilder<?, ?> ... components),
addSummary(ComponentBuilder<?, ?> ... components)
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

methoddescription
setNoDataStyle(StyleBuilder style) Sets a no data band style
noData(ComponentBuilder<?, ?> ... components),
addNoData(ComponentBuilder<?, ?> ... components)
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

methoddescription
setBackgroundStyle(StyleBuilder style) Sets a background band style
background(ComponentBuilder<?, ?> ... components),
addBackground(ComponentBuilder<?, ?> ... components)
Adds components to the background band
Tags: layout

Latest News

  • Fri
    Jan
    27
    Changes in version 5.0.0 upgrade to JasperReports 6.4.0 upgrade to Java 1.7, DynamicReports is no longer compatibl...
  • Thu
    Jul
    28
    Changes in version 4.1.1 upgrade to JasperReports 6.2.2 added new types of component stretch type minor bug fixes...
  • Thu
    Feb
    11
    Changes in version 4.1.0 upgrade to JasperReports 6.2.0 xyList component, see ComponentsReport for an example