Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid split of text field to multiple pages

I have a main report and in the main report a sub report called this:

<detail>
    <band height="50">
        <subreport>
            <reportElement x="0" y="1" width="802" height="49" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>
            <subreportParameter name="project_id">
                <subreportParameterExpression><![CDATA[$P{project_id}]]></subreportParameterExpression>
            </subreportParameter>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA["subs/Project_planned.jasper"]]></subreportExpression>
        </subreport>
    </band>
</detail>

There is a problem in the subreport because text fields in the detail band are split up on multiple pages what doesn't look very nice. Is there an option to prevent text fields from splitting up to multiple pages when using the property isStretchWithOverflow

Current code of a text field

                <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement stretchType="RelativeToBandHeight" x="555" y="0" width="99" height="21" isPrintInFirstWholeBand="true" forecolor="#000000"/>
                <box leftPadding="2">
                    <topPen lineWidth="1.0" lineColor="#000000"/>
                    <leftPen lineWidth="1.0" lineColor="#000000"/>
                    <bottomPen lineWidth="1.0" lineColor="#000000"/>
                    <rightPen lineWidth="1.0" lineColor="#000000"/>
                </box>
                <textElement verticalAlignment="Middle">
                    <paragraph lineSpacing="Single"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{logic}]]></textFieldExpression>
            </textField>

Example on how it looks (sorry for the missing data):

avoid split of text field on multiple pages

like image 745
Michel Avatar asked May 24 '12 20:05

Michel


1 Answers

Yes there is, but not on the text field. For the band the text field is in, you can set the Split Type to Prevent. if you set that on the Detail Band and the row needs to overflow to next page, it will move the entire row to the next page.

like image 169
Jacob Schoen Avatar answered Sep 28 '22 09:09

Jacob Schoen