Skip to main content

Stretch a row if data overflows in jasper reports

It is very common that some columns of the report need to stretch to show all the content in that column. But  if you just specify the property " stretch with overflow' to that column(we called text field in jasper report world) , it will just stretch that column and won't change other columns, so the row could be ridiculous. Haven't find the solution from internet yet. So I just review the properties in iReport one by one and find two useful properties(the bold highlighted in example below) which resolve the problems.   example:
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
    <reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="192" y="0" width="183" height="20"/>
    <box leftPadding="2">
     <pen lineWidth="0.25"/>
     <topPen lineWidth="0.25"/>
     <leftPen lineWidth="0.25"/>
     <bottomPen lineWidth="0.25"/>
     <rightPen lineWidth="0.25"/>
    </box>
    <textElement/>
    <textFieldExpression class="java.lang.String"><![CDATA[$F{SCHEDULE_DESCRIPTION}]]></textFieldExpression>
   </textField>
  </band>

Comments

Post a Comment