I have a report set up with a Title band and a Detail band containing a table. There is no spacing between these two bands. When I view/print the report, the Detail band begins printing at the top of page 2, and page 1 is left with a large blank space between the header and the footer.
How can I get the Detail band to print directly beneath the title on page 1?
Edit: Code below.
<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="Summary" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="24a40acb-a702-48a6-b655-04f85fdba2a9">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
...
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
...
</staticText>
...
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="753" splitType="Stretch">
<componentElement>
<reportElement uuid="3835c484-c5a2-4615-8018-b95d8d0b7f43" x="0" y="0" width="555" height="753" isPrintWhenDetailOverflows="true"/>
<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">
...
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="29" splitType="Stretch">
<staticText>
...
</staticText>
...
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
Best Answer
Most likely the detail band is so large that the report starts it on the second page to display as much of it as possible.
printWhenDetailOverflows
should be the relevant parameter.If your report is small enough (or the result is what you desired) you can set
ignorePagination
on the top element totrue
and get everything in one page.Also, you have a
pageHeight
of842
, minus40
margin makes802
per page. Yourdetail
band is753
, thetitle
is79
, so they don't fit together on one page.