JasperReports text field stretching - can stretch height be limited?

独自空忆成欢 提交于 2019-12-02 07:29:05

Put both the subreport and the text field into a frame. For the text field, set "Stretch with overflow" to false and "Stretch type" to "Relative to tallest object"

The text field will stretch relative to the tallest object in it's container. It's container is now the frame, so the "tallest object" can only be the subreport. Make sure the elements are the same height when you define them, otherwise they will grow at different rates.

JRXML sample:

<band height="50">
    <frame>
        <reportElement x="0" y="0" width="555" height="50"/>
        <subreport>
            <reportElement x="0" y="0" width="378" height="50"/>
            ...
        </subreport>
        <textField isStretchWithOverflow="false">
            <reportElement stretchType="RelativeToTallestObject" x="378" y="0" width="177" height="50"/>
            ...
        </textField>
    </frame> 
</band>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!