Jump to content
We've recently updated our Privacy Statement, available here ×

JasperReport to set height of textfield dynamically


plaidshirtakos

Recommended Posts

I would like to set height of `textField` dinamically. Height should be adjusted automatically according to length of text in it. I set stretchType to RelativeToTallestObject, but I get error message when `Stretch with Overflow option` is true.

        <textField>            <reportElement x="0" y="100" width="550" height="60" uuid="">                <property name="com.jaspersoft.studio.unit.height" value="px"/>                <property name="com.jaspersoft.studio.unit.width" value="px"/>                <property name="com.jaspersoft.studio.unit.y" value="px"/>            </reportElement>            <textElement textAlignment="Justified" markup="html">                <font fontName="DejaVu Sans" size="10" isBold="false"/>            </textElement>            <textFieldExpression></textFieldExpression>        </textField>[/code]
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

<textField textAdjust="StretchHeight">    <reportElement x="0" y="0" width="1520" height="15" uuid="6cb61704-2f0a-4b05-b714-f0219175f001">        <property name="com.jaspersoft.studio.element.name" value="content"/>    </reportElement>    <box topPadding="35" leftPadding="35" bottomPadding="35" rightPadding="35"/>    <textFieldExpression><![CDATA[$F{point4}]]></textFieldExpression></textField>[/code]

Just use textAdjust="StretchHeight" in your text field. It's will be stretch base on the content inside.

Link to comment
Share on other sites

Just an addition to the answer from I am Leo, because I had some similar problems recently. If your Studio version is < 6.10.0, you need to use

<textField isStretchWithOverflow="true">[/code]

instead. For versions >= 6.10.0 it needs to be

<textField textAdjust="StretchHeight">[/code]
Link to comment
Share on other sites

  • 3 years later...

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...