title: using break in JasperReports 4.7.0 vs 5.1.2
body: <p>We are generating an <em>Excel</em> report from <em>Ext JS</em> UI which has a few filter parameters and a button to fetch the data as per the selected filters. The data is displayed in a <em>Ext JS</em> grid below the filter components. During the export of data, the filter parameters are to be put in the sheet 1 of <em>Excel</em> and the data to be put in the sheet 2. This works fine with <em>JasperReports</em> jar 4.7.0 but with <em>JR</em> jar 5.1.2, the filter details and the data are in the same sheet. Note that there is no code change and just the jar has changed. </p>
  
  <p>Please let me know if I'm missing something.</p>
  
  <p>Below is the jrxml and a few lines of <em>Java</em> code:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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="REPORT TITLE" pageWidth="1400" pageHeight="800" columnWidth="1360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" isIgnorePagination="true"&gt;
      &lt;property name="ireport.zoom" value="1.0"/&gt;
      &lt;property name="ireport.x" value="851"/&gt;
      &lt;property name="ireport.y" value="0"/&gt;
      &lt;property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="true"/&gt;
      &lt;property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/&gt;
      &lt;property name="net.sf.jasperreports.export.xlsx.detect.cell.type" value="true"/&gt;
      &lt;property name="net.sf.jasperreports.export.xls.sheet.names.all" value="Filter Criteria/REPORT TITLE"/&gt;
      &lt;style name="table 2_CH" isDefault="true" mode="Opaque"&gt;
          &lt;box&gt;
              &lt;pen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;/box&gt;
          &lt;paragraph leftIndent="2" rightIndent="2"/&gt;
      &lt;/style&gt;
      &lt;style name="table 3_CH" mode="Opaque" isBold="true"/&gt;
      &lt;subDataset name="Table Dataset 1"&gt;
          &lt;parameter name="reportDataSrc" class="java.lang.Object"&gt;
              &lt;parameterDescription&gt;&lt;![CDATA[reportDataSrc]]&gt;&lt;/parameterDescription&gt;
          &lt;/parameter&gt;
          &lt;field name="xxx" class="java.lang.Object"&gt;
              &lt;fieldDescription&gt;&lt;![CDATA[xxx]]&gt;&lt;/fieldDescription&gt;
          &lt;/field&gt;
  
      &lt;/subDataset&gt;
      &lt;parameter name="reportTitle" class="java.lang.String"/&gt;
      &lt;parameter name="dataSrc" class="java.util.List"&gt;
          &lt;parameterDescription&gt;&lt;![CDATA[dataSrc]]&gt;&lt;/parameterDescription&gt;
      &lt;/parameter&gt;
      &lt;parameter name="Filter_Information" class="net.sf.jasperreports.engine.JasperReport"&gt;
          &lt;parameterDescription&gt;&lt;![CDATA[Filter_Information]]&gt;&lt;/parameterDescription&gt;
      &lt;/parameter&gt;
      &lt;parameter name="filterInformationSrc" class="java.util.List"&gt;
          &lt;parameterDescription&gt;&lt;![CDATA[filterInformationSrc]]&gt;&lt;/parameterDescription&gt;
      &lt;/parameter&gt;
      &lt;parameter name="fileType" class="java.lang.String"&gt;
          &lt;parameterDescription&gt;&lt;![CDATA[fileType]]&gt;&lt;/parameterDescription&gt;
      &lt;/parameter&gt;
      &lt;parameter name="user" class="java.lang.Object"&gt;
          &lt;parameterDescription&gt;&lt;![CDATA[user]]&gt;&lt;/parameterDescription&gt;
      &lt;/parameter&gt;
      &lt;background&gt;
          &lt;band splitType="Stretch"/&gt;
      &lt;/background&gt;
      &lt;title&gt;
          &lt;band/&gt;
      &lt;/title&gt;
      &lt;pageFooter&gt;
          &lt;band height="10"&gt;
              &lt;textField evaluationTime="Report"&gt;
                  &lt;reportElement style="table 3_CH" positionType="Float" x="765" y="0" width="120" height="10" isRemoveLineWhenBlank="true"&gt;
                      &lt;printWhenExpression&gt;&lt;![CDATA[new java.lang.Boolean($P{fileType} != null &amp;&amp; $P{fileType}.equalsIgnoreCase("PDF") )]]&gt;&lt;/printWhenExpression&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement&gt;
                      &lt;font fontName="Arial" size="8" isItalic="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA["User : " + ($P{user})]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement style="table 3_CH" positionType="Float" x="985" y="0" width="74" height="10" isRemoveLineWhenBlank="true"&gt;
                      &lt;printWhenExpression&gt;&lt;![CDATA[new java.lang.Boolean($P{fileType} != null &amp;&amp; $P{fileType}.equalsIgnoreCase("PDF") )]]&gt;&lt;/printWhenExpression&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement textAlignment="Right"&gt;
                      &lt;font fontName="Arial" size="8" isItalic="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA["Page "+($V{PAGE_NUMBER}.intValue())+" of"]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField evaluationTime="Report"&gt;
                  &lt;reportElement style="table 3_CH" positionType="Float" x="1059" y="0" width="21" height="10" isRemoveLineWhenBlank="true"&gt;
                      &lt;printWhenExpression&gt;&lt;![CDATA[new java.lang.Boolean($P{fileType} != null &amp;&amp; $P{fileType}.equalsIgnoreCase("PDF") )]]&gt;&lt;/printWhenExpression&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement&gt;
                      &lt;font fontName="Arial" size="8" isItalic="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[" " + ($V{PAGE_NUMBER}.intValue())]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField pattern="dd-MMM-yyyy h.mm a"&gt;
                  &lt;reportElement style="table 3_CH" positionType="Float" x="1180" y="0" width="120" height="10" isRemoveLineWhenBlank="true"&gt;
                      &lt;printWhenExpression&gt;&lt;![CDATA[new java.lang.Boolean($P{fileType} != null &amp;&amp; $P{fileType}.equalsIgnoreCase("PDF") )]]&gt;&lt;/printWhenExpression&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement&gt;
                      &lt;font fontName="Arial" size="8" isItalic="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[new java.util.Date()]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/pageFooter&gt;
      &lt;summary&gt;
          &lt;band height="48" splitType="Stretch"&gt;
              &lt;subreport&gt;
                  &lt;reportElement positionType="Float" mode="Opaque" x="0" y="0" width="600" height="1" isRemoveLineWhenBlank="true"&gt;
                      &lt;printWhenExpression&gt;&lt;![CDATA[new java.lang.Boolean($P{filterInformationSrc} != null &amp;&amp; $P{filterInformationSrc}.size() &gt; 0 )]]&gt;&lt;/printWhenExpression&gt;
                  &lt;/reportElement&gt;
                  &lt;subreportParameter name="filterInformationSrc"&gt;
                      &lt;subreportParameterExpression&gt;&lt;![CDATA[$P{filterInformationSrc}]]&gt;&lt;/subreportParameterExpression&gt;
                  &lt;/subreportParameter&gt;
                  &lt;dataSourceExpression&gt;&lt;![CDATA[(new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{filterInformationSrc}))]]&gt;&lt;/dataSourceExpression&gt;
                  &lt;subreportExpression&gt;&lt;![CDATA[$P{Filter_Information}]]&gt;&lt;/subreportExpression&gt;
              &lt;/subreport&gt;
              &lt;break&gt;
                  &lt;reportElement positionType="Float" x="0" y="1" width="100" height="1" isRemoveLineWhenBlank="true"&gt;
                      &lt;printWhenExpression&gt;&lt;![CDATA[new java.lang.Boolean($P{fileType} != null &amp;&amp; $P{fileType}.equalsIgnoreCase("Excel") &amp;&amp; $P{filterInformationSrc} != null &amp;&amp; $P{filterInformationSrc}.size() &gt; 0 )]]&gt;&lt;/printWhenExpression&gt;
                  &lt;/reportElement&gt;
              &lt;/break&gt;
              &lt;componentElement&gt;
                  &lt;reportElement key="" style="table 2_CH" positionType="Float" x="0" y="6" width="1360" height="42" isPrintWhenDetailOverflows="true"/&gt;
                  &lt;jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"&gt;
                      &lt;datasetRun subDataset="Table Dataset 1"&gt;
                          &lt;datasetParameter name="reportDataSrc"&gt;
                              &lt;datasetParameterExpression&gt;&lt;![CDATA[$P{dataSrc}]]&gt;&lt;/datasetParameterExpression&gt;
                          &lt;/datasetParameter&gt;
                          &lt;dataSourceExpression&gt;&lt;![CDATA[(new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{dataSrc}))]]&gt;&lt;/dataSourceExpression&gt;
                      &lt;/datasetRun&gt;
                      &lt;jr:column width="151"&gt;
                          &lt;jr:columnHeader style="table 2_CH" height="25" rowSpan="1"&gt;
                              &lt;staticText&gt;
                                  &lt;reportElement x="0" y="0" width="151" height="25" backcolor="#99CCFF"/&gt;
                                  &lt;textElement textAlignment="Left" verticalAlignment="Top"&gt;
                                      &lt;font fontName="Arial" size="9" isBold="true"/&gt;
                                  &lt;/textElement&gt;
                                  &lt;text&gt;&lt;![CDATA[xxx]]&gt;&lt;/text&gt;
                              &lt;/staticText&gt;
                          &lt;/jr:columnHeader&gt;
                          &lt;jr:detailCell style="table 2_CH" height="25" rowSpan="1"&gt;
                              &lt;textField isBlankWhenNull="true"&gt;
                                  &lt;reportElement x="0" y="0" width="151" height="25"/&gt;
                                  &lt;textElement textAlignment="Left" verticalAlignment="Top"&gt;
                                      &lt;font fontName="Arial" size="8"/&gt;
                                  &lt;/textElement&gt;
                                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{xxx}]]&gt;&lt;/textFieldExpression&gt;
                              &lt;/textField&gt;
                          &lt;/jr:detailCell&gt;
                      &lt;/jr:column&gt;                    
                  &lt;/jr:table&gt;
              &lt;/componentElement&gt;
          &lt;/band&gt;
      &lt;/summary&gt;
  &lt;/jasperReport&gt;
  </code></pre>
  
  <p>Loading jrxml</p>
  
  <pre><code>JasperDesign jasperDesignObj = JRXmlLoader.load(ReportUtil.getJRXMLResourcePath(reportType, CommonConstants.JRXML_EXTENSION));
  JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(dataProviderList);
  JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesignObj);
  JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, beanColDataSource);
  </code></pre>
  
  <p>The jasperPrint.getPages().size() returns 2 with 4.7.1 but 1 with 5.1.2, not sure how this happens.</p>
  
  <p>Properties set:</p>
  
  <pre><code>if (CommonConstants.FILE_TYPE_EXCEL.equals(fileType)) {
      parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
      parameters.put(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
      parameters.put(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
      parameters.put(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
      parameters.put(JRXlsExporterParameter.IGNORE_PAGE_MARGINS, Boolean.TRUE);
  }
  </code></pre>