title: JasperReports Subreport Stretching
body: <p>I'm trying to create an xls-report with JasperReports.
  For that I use JasperReports 5.5.0 (and iReport in the same version) and apache poi 3.9.</p>
  
  <p>The base structure is a master-report with a subreport and this subreport also contains another subreport. For better understanding some code samples:</p>
  
  <p>Masterreport:</p>
  
  <pre><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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ada06392-98fc-4512-99d3-a4008c86ed40"&gt;
  &lt;property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.style.evaluation.time.enabled" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.print.keep.full.text" value="true"/&gt;
  &lt;property name="ireport.zoom" value="3.1384283767210035"/&gt;
  &lt;property name="ireport.x" value="34"/&gt;
  &lt;property name="ireport.y" value="0"/&gt;
  &lt;parameter name="subreportDisLayer" class="net.sf.jasperreports.engine.JasperReport" isForPrompting="false"/&gt;
  &lt;field name="nextLayerList" class="java.util.List"/&gt;
  &lt;field name="field1" class="java.lang.String"/&gt;
  &lt;field name="field2" class="java.lang.String"/&gt;
  &lt;background&gt;
      &lt;band splitType="Stretch"/&gt;
  &lt;/background&gt;
  &lt;columnHeader&gt;
      &lt;band height="42" splitType="Stretch"/&gt;
  &lt;/columnHeader&gt;
  &lt;detail&gt;
      &lt;band height="13" splitType="Stretch"&gt;
          &lt;subreport isUsingCache="true" runToBottom="true"&gt;
              &lt;reportElement x="0" y="0" width="555" height="13" isPrintWhenDetailOverflows="true" uuid="222f19ef-c9f7-40a9-ae44-11ef6e15f1ad"/&gt;
              &lt;subreportParameter name="subsubreportLayer"&gt;
                  &lt;subreportParameterExpression&gt;&lt;![CDATA[$P{subsubreportLayer}]]&gt;&lt;/subreportParameterExpression&gt;
              &lt;/subreportParameter&gt;
              &lt;dataSourceExpression&gt;&lt;![CDATA[new JRBeanCollectionDataSource($F{nextLayerList})]]&gt;&lt;/dataSourceExpression&gt;
              &lt;subreportExpression&gt;&lt;![CDATA[$P{subreportLayer}]]&gt;&lt;/subreportExpression&gt;
          &lt;/subreport&gt;
          &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
              &lt;reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="40" y="0" width="30" height="13" isPrintWhenDetailOverflows="true" uuid="ab260763-72ff-47ff-ad53-dfedde447908"/&gt;
              &lt;box&gt;
                  &lt;topPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;leftPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;bottomPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;rightPen lineWidth="0.5" lineColor="#000000"/&gt;
              &lt;/box&gt;
              &lt;textElement&gt;
                  &lt;font size="8"/&gt;
                  &lt;paragraph leftIndent="2" tabStopWidth="4"/&gt;
              &lt;/textElement&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$F{field1}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
              &lt;reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="70" y="0" width="50" height="13" isPrintWhenDetailOverflows="true" uuid="c408ac05-ee11-4e49-9609-179429b76e20"/&gt;
              &lt;box&gt;
                  &lt;topPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;leftPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;bottomPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;rightPen lineWidth="0.5" lineColor="#000000"/&gt;
              &lt;/box&gt;
              &lt;textElement&gt;
                  &lt;font size="8"/&gt;
                  &lt;paragraph leftIndent="2" tabStopWidth="4"/&gt;
              &lt;/textElement&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$F{field2}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
      &lt;/band&gt;
  &lt;/detail&gt;
  </code></pre>
  
  <p></p>
  
  <p>Subreport 1:</p>
  
  <pre><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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="ada06392-98fc-4512-99d3-a4008c86ed40"&gt;
  &lt;property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.style.evaluation.time.enabled" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/&gt;
  &lt;property name="net.sf.jasperreports.print.keep.full.text" value="true"/&gt;
  &lt;property name="ireport.zoom" value="3.1384283767210035"/&gt;
  &lt;property name="ireport.x" value="34"/&gt;
  &lt;property name="ireport.y" value="0"/&gt;
  &lt;parameter name="subsubreportLayer" class="net.sf.jasperreports.engine.JasperReport" isForPrompting="false"/&gt;
  &lt;field name="nextLayerList" class="java.util.List"/&gt;
  &lt;field name="field3" class="java.lang.String"/&gt;
  &lt;background&gt;
      &lt;band splitType="Stretch"/&gt;
  &lt;/background&gt;
  &lt;detail&gt;
      &lt;band height="13" splitType="Stretch"&gt;
          &lt;subreport isUsingCache="true" &gt;
              &lt;reportElement x="0" y="0" width="555" height="13" isPrintWhenDetailOverflows="true" uuid="222f19ef-c9f7-40a9-ae44-11ef6e15f1ad"/&gt;
              &lt;dataSourceExpression&gt;&lt;![CDATA[new JRBeanCollectionDataSource($F{nextLayerList})]]&gt;&lt;/dataSourceExpression&gt;
              &lt;subreportExpression&gt;&lt;![CDATA[$P{subsubreportLayer}]]&gt;&lt;/subreportExpression&gt;
          &lt;/subreport&gt;
          &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
              &lt;reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="274" y="0" width="100" height="13" isPrintWhenDetailOverflows="true" uuid="7fae7678-55c7-4308-9977-f71e215b38c9"/&gt;
              &lt;box&gt;
                  &lt;topPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;leftPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;bottomPen lineWidth="0.5" lineColor="#000000"/&gt;
                  &lt;rightPen lineWidth="0.5" lineColor="#000000"/&gt;
              &lt;/box&gt;
              &lt;textElement&gt;
                  &lt;font size="8"/&gt;
                  &lt;paragraph leftIndent="2" tabStopWidth="4"/&gt;
              &lt;/textElement&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$F{field3}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
      &lt;/band&gt;
  &lt;/detail&gt;
  </code></pre>
  
  <p></p>
  
  <p>The second subreport looks almost the same like the first one.</p>
  
  <p>My problem is, that if the row height of the master is larger than the whole band height of a subreport, the subreport won't stretch its band height to the masters row height.
  I know it has to be just a simple combination of settings, but I can't find it.</p>