javapdfjasper-reportsreportingoverlapping

Jasperreports multiple subreports overlapping


I have a master detail with 2 subreports back to back vertically they don't have too much space because the master report is quite long.... I have specify in both subreports the FLOAT attribute. Everything works smoothly when the data of both fill in the space assigned in IREPORT, but when they have a lot of rows, I mean 3 or more rows, the second subreport Materiales overlaps the next component... I would like if some subreport need more space it would push the next component down. The TRABAJOS REALIZADOS is into a Frame with Float property but is not pushed down the frame, it is maintaining the position and gets overlapped by Materiales sub-report..

my ireport design.

enter image description here

my source code some tags are ommited by brevity

<detail>
    <band height="770" splitType="Stretch">
        .... others tags ommited by brevity
        <frame>
            <reportElement positionType="Float" x="0" y="401" width="554" height="70"/>
            <subreport runToBottom="false">
                <reportElement positionType="Float" x="1" y="1" width="553" height="69"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{munichs})]]></dataSourceExpression>
                <subreportExpression class="java.io.InputStream"><![CDATA[$P{SUBREPORT_EXPRESSION}]]></subreportExpression>
            </subreport>                
        </frame>
        <frame>
            <reportElement positionType="Float" x="2" y="472" width="551" height="128"/>
            <subreport runToBottom="false">
                <reportElement positionType="Float" x="1" y="44" width="545" height="83"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{venices})]]></dataSourceExpression>
                <subreportExpression class="java.io.InputStream"><![CDATA[$P{SUBREPORT_EXPRESSION_SECOND_REPORT}]]></subreportExpression>
            </subreport>
                     </frame>               
        <frame><!--this frame is not pushed down and gets overlapped...-->
            <reportElement positionType="Float" x="0" y="599" width="554" height="171"/>
            <rectangle>
                <reportElement x="2" y="1" width="180" height="20"/>
            </rectangle>
            <staticText>
                <reportElement x="2" y="1" width="178" height="20"/>
                <textElement/>
                <text><![CDATA[TRABAJOS PENDIENTES]]></text>
            </staticText>
            <rectangle>
                <reportElement x="2" y="21" width="550" height="38"/>
            </rectangle>
            <textField>
                <reportElement x="3" y="21" width="551" height="38"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{observations}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="2" y="64" width="100" height="20"/>
                <textElement/>
                <text><![CDATA[FIRMA OPERADOR: ]]></text>
            </staticText>
            <staticText>
                <reportElement x="333" y="64" width="107" height="20"/>
                <textElement/>
                <text><![CDATA[CONFORME CLIENTE:]]></text>
            </staticText>
            <image>
                <reportElement x="442" y="63" width="22" height="22"/>
                <imageExpression class="java.io.InputStream"><![CDATA[$F{sign}]]></imageExpression>
            </image>
            <staticText>
                <reportElement x="188" y="90" width="66" height="20"/>
                <textElement/>
                <text><![CDATA[FIRMA Y DNI:]]></text>
            </staticText>
            <image>
                <reportElement x="257" y="89" width="22" height="22"/>
                <imageExpression class="java.io.InputStream"><![CDATA[$F{conformity}]]></imageExpression>
            </image>
            <image>
                <reportElement x="281" y="89" width="264" height="32"/>
                <imageExpression class="java.io.InputStream"><![CDATA[$F{imageForSign}]]></imageExpression>
            </image>
            <textField>
                <reportElement x="2" y="122" width="543" height="49"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{lopd}]]></textFieldExpression>
            </textField>
        </frame>


    </band>
</detail>

my IReport image

enter image description here My PDF with overlapping..

enter image description here

1:


Solution

  • You can try by increasing height of detail band and if that doesn't work you can add one more detail, one for each sub-report.

    To add detail band right click on "Detail" and add second band and copy second sub-report under this band.