Jump to content

SubReports in Master Reports left Blank Space when reacheas at the end of the page and starts on new


mihir_amreli

Recommended Posts

Hello All I have encountered very strange problem while using Sub report in main report. I have a Sub Report with column title and a detail section both of height 20px. when the sub reports record displays on the main report it prints as expected until when it reaches at the bottom of the page. what happened at that time is , sub report prints just column header and left blank space , then again starts on new page with column header and its detail.so, what i want to do is either print the whole sub report on same page or start whole report from new page .

I am attaching here the detail section XML.

Thank You

Mihir Parekh

 

Code:
<detail>        <band height="20" splitType="Stretch">            <frame>                <reportElement x="0" y="0" width="802" height="20"/>                <subreport isUsingCache="true" runToBottom="false">                    <reportElement x="117" y="0" width="430" height="20" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true">                        <printWhenExpression><![CDATA[$F{subReportName}.equals( "subReportDemo_subreport1.jasper" )]]></printWhenExpression>                    </reportElement>                    <subreportParameter name="salesman">                        <subreportParameterExpression><![CDATA[$F{salesman}]]></subreportParameterExpression>                    </subreportParameter>                    <subreportParameter name="kasar">                        <subreportParameterExpression><![CDATA[$F{kasar}]]></subreportParameterExpression>                    </subreportParameter>                    <subreportParameter name="roundoff">                        <subreportParameterExpression><![CDATA[$F{roundOff}]]></subreportParameterExpression>                    </subreportParameter>                    <subreportParameter name="roundoffSymbol">                        <subreportParameterExpression><![CDATA[$F{roundOffSymbol}]]></subreportParameterExpression>                    </subreportParameter>                    <subreportParameter name="discount">                        <subreportParameterExpression><![CDATA[$F{discount}]]></subreportParameterExpression>                    </subreportParameter>                    <dataSourceExpression><![CDATA[$F{subReportName}.equals( "subReportDemo_subreport1.jasper" ) ? new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{parti}) : new JREmptyDataSource()]]></dataSourceExpression>                    <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "/subReportDemo_subreport1.jasper"]]></subreportExpression>                </subreport>                <textField isBlankWhenNull="true">                    <reportElement stretchType="RelativeToTallestObject" x="44" y="0" width="73" height="20"/>                    <box leftPadding="1">                        <pen lineWidth="1.0"/>                        <topPen lineWidth="1.0"/>                        <leftPen lineWidth="1.0"/>                        <bottomPen lineWidth="1.0"/>                        <rightPen lineWidth="1.0"/>                    </box>                    <textElement verticalAlignment="Middle"/>                    <textFieldExpression class="java.lang.String"><![CDATA[$F{vNo}]]></textFieldExpression>                </textField>                <textField isBlankWhenNull="true">                    <reportElement stretchType="RelativeToTallestObject" x="626" y="0" width="78" height="20"/>                    <box leftPadding="1">                        <pen lineWidth="1.0"/>                        <topPen lineWidth="1.0"/>                        <leftPen lineWidth="1.0"/>                        <bottomPen lineWidth="1.0"/>                        <rightPen lineWidth="1.0"/>                    </box>                    <textElement verticalAlignment="Middle"/>                    <textFieldExpression class="java.lang.Double"><![CDATA[$F{creditAmount}]]></textFieldExpression>                </textField>                <textField isStretchWithOverflow="true" isBlankWhenNull="true">                    <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="44" height="20"/>                    <box leftPadding="1">                        <pen lineWidth="1.0"/>                        <topPen lineWidth="1.0"/>                        <leftPen lineWidth="1.0"/>                        <bottomPen lineWidth="1.0"/>                        <rightPen lineWidth="1.0"/>                    </box>                    <textElement verticalAlignment="Middle"/>                    <textFieldExpression class="java.lang.String"><![CDATA[($F{vDate}.substring(0,$V{caretPosition}.intValue()+1) +$F{vDate}.substring(($V{caretPosition}.intValue()+3),$F{vDate}.length()))]]></textFieldExpression>                </textField>                <textField isBlankWhenNull="true">                    <reportElement stretchType="RelativeToTallestObject" x="548" y="0" width="78" height="20"/>                    <box leftPadding="1">                        <pen lineWidth="1.0"/>                        <topPen lineWidth="1.0"/>                        <leftPen lineWidth="1.0"/>                        <bottomPen lineWidth="1.0"/>                        <rightPen lineWidth="1.0"/>                    </box>                    <textElement verticalAlignment="Middle"/>                    <textFieldExpression class="java.lang.Double"><![CDATA[$F{debitAmount}]]></textFieldExpression>                </textField>                <subreport runToBottom="false">                    <reportElement x="117" y="0" width="430" height="20" isRemoveLineWhenBlank="true">                        <printWhenExpression><![CDATA[$F{subReportName}.equals( "paymentSuReport.jasper" )]]></printWhenExpression>                    </reportElement>                    <subreportParameter name="kasar">                        <subreportParameterExpression><![CDATA[$F{kasar}]]></subreportParameterExpression>                    </subreportParameter>                    <dataSourceExpression><![CDATA[$F{subReportName}.equals( "paymentSuReport.jasper" ) ? new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{parti}) : new JREmptyDataSource()]]></dataSourceExpression>                    <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "\\paymentSuReport.jasper"]]></subreportExpression>                </subreport>                <subreport>                    <reportElement x="117" y="0" width="430" height="20" isRemoveLineWhenBlank="true">                        <printWhenExpression><![CDATA[$F{subReportName}.equals( "cashSubReport.jasper" )]]></printWhenExpression>                    </reportElement>                    <dataSourceExpression><![CDATA[$F{subReportName}.equals( "cashSubReport.jasper" ) ? new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{parti}) : new JREmptyDataSource()]]></dataSourceExpression>                    <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "/cashSubReport.jasper"]]></subreportExpression>                </subreport>                <frame>                    <reportElement x="117" y="0" width="431" height="20"/>                    <box>                        <pen lineWidth="1.0"/>                        <topPen lineWidth="1.0"/>                        <leftPen lineWidth="1.0"/>                        <bottomPen lineWidth="1.0"/>                        <rightPen lineWidth="1.0"/>                    </box>                </frame>            </frame>            <textField isBlankWhenNull="true">                <reportElement stretchType="RelativeToTallestObject" x="782" y="0" width="20" height="20"/>                <box leftPadding="1">                    <pen lineWidth="1.0"/>                    <topPen lineWidth="1.0"/>                    <leftPen lineWidth="1.0"/>                    <bottomPen lineWidth="1.0"/>                    <rightPen lineWidth="1.0"/>                </box>                <textElement verticalAlignment="Middle"/>                <textFieldExpression class="java.lang.String"><![CDATA[$F{currentBalanceSymbol}]]></textFieldExpression>            </textField>            <textField isBlankWhenNull="true">                <reportElement stretchType="RelativeToTallestObject" x="704" y="0" width="78" height="20"/>                <box leftPadding="1">                    <pen lineWidth="1.0"/>                    <topPen lineWidth="1.0"/>                    <leftPen lineWidth="1.0"/>                    <bottomPen lineWidth="1.0"/>                    <rightPen lineWidth="1.0"/>                </box>                <textElement verticalAlignment="Middle"/>                <textFieldExpression class="java.lang.Double"><![CDATA[$F{currentBalance}]]></textFieldExpression>            </textField>        </band>    </detail>
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...

Hi,

Am also facing the same prb and using splitType="Prevent" didnt help me as I dont want the subreport to be generated on the next page.

I have attached the screen shot.

Please help as this code has to go to production in a few days.

Thanks in advance.

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...