Jasper Report is an awesome open source Java reporting tool. It is used to generate dynamic reports using .jasper or JRXML file.

Jasper report contains several bands:

  • Title:
    This band is printed only once at the beginning of the generated document.
  • Page Header:
    This band is printed at the beginning on each page of the generated document.
  • Column Header:
    This band is printed at the beginning of each column of the generated document.
  • Detail:
    This band is printed multiple times depending upon the numbers of items supplied data source have. A jasper report can have multiple detail bands.
  • Column Footer:
    This band is printed at the bottom of each column of the generated document.
  • Page Footer:
    This band is printed at the bottom of each page of the generated document.
  • Summary:
    This band is printed only once after the detail bands in the generated document.

These are the main bands in a jasper report. Except these bands, a jasper report can also have following bands:

  • Last Page Footer:
    This band is printed at the bottom of the last page of the generated document. This band replaces the Page Footer band of the last page, i.e., this band is printed instead of the Page Footer band on the last page of the generated document.
  • No Data:
    This band is printed if “When No Data” property of the report is set to “No Data Section” and provided data source is empty.
  • Background:
    This band is printed on every page of the generated document. All the elements in this band are printed in the background. All the other band elements are printed on the top of this background band. This band is generally used to print watermarks on the document.

That’s all about jasper report bands.

I have created a sample jasper report to demonstrate these bands in action:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="testReport" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="cfab0db2-a23a-417c-80fa-bac43912f0b4">
  <property name="ireport.zoom" value="1.0"/>
  <property name="ireport.x" value="0"/>
  <property name="ireport.y" value="186"/>
  <style name="border">
    <box>
      <pen lineWidth="1.0" lineColor="#000000"/>
      <topPen lineWidth="1.0" lineColor="#000000"/>
      <leftPen lineWidth="1.0" lineColor="#000000"/>
      <bottomPen lineWidth="1.0" lineColor="#000000"/>
      <rightPen lineWidth="1.0" lineColor="#000000"/>
    </box>
  </style>
  <queryString>
    <![CDATA[SELECT
      language.<code>id</code> AS id,
      language.<code>name</code> AS name
      FROM
     <code>language</code> language
      LIMIT
    5]]&gt;
  &lt;/queryString&gt;
  &lt;field name=&quot;id&quot; class=&quot;java.lang.Long&quot;&gt;
    &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name=&quot;name&quot; class=&quot;java.lang.String&quot;&gt;
    &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;background&gt;
    &lt;band height=&quot;802&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      	&lt;reportElement x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;802&quot; forecolor=&quot;#CFD7DB&quot; uuid=&quot;6170ad9e-59b5-45a1-8eea-4f66e2c1a83d&quot;/&gt;
	&lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot; rotation=&quot;Left&quot;&gt;
	&lt;font size=&quot;60&quot;/&gt;
	&lt;/textElement&gt;
	&lt;text&gt;&lt;![CDATA[JellyFish Technologies]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/background&gt;
  &lt;title&gt;
    &lt;band height=&quot;25&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;6592973d-6527-43ed-b50c-7c27f18315d8&quot;/&gt;
      &lt;box topPadding=&quot;0&quot; leftPadding=&quot;0&quot; bottomPadding=&quot;0&quot; rightPadding=&quot;0&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
        &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[TITLE]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/title&gt;
  &lt;pageHeader&gt;
    &lt;band height=&quot;25&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;bc9fb8af-15de-41c6-8456-d98d5f7b6cf1&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[PAGE HEADER]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/pageHeader&gt;
  &lt;columnHeader&gt;
    &lt;band height=&quot;25&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;99a4d96a-312f-47a6-98da-6ae8d3f40c56&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[COLUMN HEADER]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/columnHeader&gt;
  &lt;detail&gt;
    &lt;band height=&quot;125&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;textField&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;125&quot; uuid=&quot;9a76c63c-5385-4f49-abc1-9f7fa9427198&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;textFieldExpression&gt;&lt;![CDATA[$F{name}]]&gt;&lt;/textFieldExpression&gt;
      &lt;/textField&gt;
    &lt;/band&gt;
  &lt;/detail&gt;
  &lt;columnFooter&gt;
    &lt;band height=&quot;25&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;18f0ae8e-0a01-4bdb-80ac-e48963dad884&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[COLUMN FOOTER]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/columnFooter&gt;
  &lt;pageFooter&gt;
    &lt;band height=&quot;25&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;0e2cefd1-832c-452d-ad04-2ecdad6e8422&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[PAGE FOOTER]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/pageFooter&gt;
  &lt;lastPageFooter&gt;
    &lt;band height=&quot;25&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;1a7cab0d-2066-4e97-8931-abb17bb3a531&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[LAST PAGE FOOTER]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/lastPageFooter&gt;
  &lt;summary&gt;
    &lt;band height=&quot;25&quot; splitType=&quot;Stretch&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;25&quot; uuid=&quot;98b792b7-ab0f-4d44-86db-44bed55770a6&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[SUMMARY]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/summary&gt;
  &lt;noData&gt;
    &lt;band height=&quot;50&quot;&gt;
      &lt;staticText&gt;
      &lt;reportElement style=&quot;border&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;555&quot; height=&quot;50&quot; uuid=&quot;c39b266f-a1d2-4050-98a4-2b32cd1a87f3&quot;/&gt;
      &lt;textElement textAlignment=&quot;Center&quot; verticalAlignment=&quot;Middle&quot;&gt;
      &lt;font size=&quot;12&quot;/&gt;
      &lt;/textElement&gt;
      &lt;text&gt;&lt;![CDATA[NO DATA]]&gt;&lt;/text&gt;
      &lt;/staticText&gt;
    &lt;/band&gt;
  &lt;/noData&gt;
&lt;/jasperReport&gt;

And following are some images of the different document I have generated:

  • Multipage Document Demo:
    First Page:

    testReportFirstPage

    Second Page:
    testReportLastPageFooter

  • No Data Band Demo:
    testReportNoDataSection
  • Background Band Demo:
    testReportBackgroundDemo

Note:- I have used iReport(v5.5.0) to design this jasper report.

Enjoy Coding 🙂 .