0

Hi I am using jasperreports verion + 5.0.1

I am trying to apply stretch for one of the text field. I kept this frame in a detail band. Underneath this frame I have another frame.

My requirement here is to stretch the text field mailingAddress and agentAddress. These details will be exported into a PDF. Which in-turn should stretch the frame along with the frames below need to be pushed accordingly in vertical position.

<frame>
   <reportElement positionType="Float" x="0" y="66" width="802" height="14" isPrintWhenDetailOverflows="true" forecolor="#959595" uuid="063598fc-a760-48d4-86e1-c85da3ab415d">
      <property name="com.jaspersoft.studio.unit.height" value="pixel" />
      <property name="com.jaspersoft.studio.unit.y" value="px" />
      <property name="com.jaspersoft.studio.layout" />
   </reportElement>
   <box>
      <pen lineWidth="0.25" lineColor="#959595" />
      <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000" />
      <leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#959595" />
      <bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#959595" />
      <rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#959595" />
   </box>
   <staticText>
      <reportElement style="HeaderElement8x" x="4" y="1" width="70" height="13" isPrintWhenDetailOverflows="true" uuid="8908bd70-9665-4f4c-a501-e07ef7c96cce">
         <property name="com.jaspersoft.studio.unit.height" value="px" />
         <property name="com.jaspersoft.studio.unit.width" value="px" />
      </reportElement>
      <textElement verticalAlignment="Middle">
         <font size="8" />
      </textElement>
      <text><![CDATA[Mailing Address:]]></text>
   </staticText>
   <textField textAdjust="StretchHeight">
      <reportElement style="HeaderElementBold7x" positionType="Float" stretchType="RelativeToTallestObject" x="80" y="1" width="200" height="13" isPrintWhenDetailOverflows="true" uuid="e29aefcf-9df6-4dd8-a261-e5a9a7cf1659">
         <property name="com.jaspersoft.studio.unit.width" value="px" />
         <property name="com.jaspersoft.studio.unit.height" value="px" />
         <property name="com.jaspersoft.studio.unit.x" value="px" />
      </reportElement>
      <textElement>
         <font size="7" isBold="true" />
      </textElement>
      <textFieldExpression><![CDATA[$F{mailingAddress}]]></textFieldExpression>
   </textField>
   <staticText>
      <reportElement style="HeaderElement8x" x="362" y="1" width="85" height="13" isPrintWhenDetailOverflows="true" uuid="74a57ccd-1001-46db-ac19-daab648cba60">
         <property name="com.jaspersoft.studio.unit.height" value="px" />
         <property name="com.jaspersoft.studio.unit.width" value="px" />
      </reportElement>
      <textElement verticalAlignment="Middle">
         <font size="8" />
      </textElement>
      <text><![CDATA[Agent Address:]]></text>
   </staticText>
   <textField>
      <reportElement style="HeaderElementBold7x" positionType="Float" stretchType="RelativeToTallestObject" x="448" y="1" width="200" height="13" isPrintWhenDetailOverflows="true" uuid="cc500f79-88a8-4357-845c-090fab89a0d2">
         <property name="com.jaspersoft.studio.unit.height" value="px" />
         <property name="com.jaspersoft.studio.unit.width" value="px" />
         <property name="com.jaspersoft.studio.unit.x" value="px" />
      </reportElement>
      <textElement>
         <font size="7" isBold="true" />
      </textElement>
      <textFieldExpression><![CDATA[$F{agentAddress}]]></textFieldExpression>
   </textField>
</frame>

I tried following but it doesn't worked for me. Help me out with your suggestions please.

enter image description here

Alex K
  • 22,315
  • 19
  • 108
  • 236
Rajesh Kumar
  • 39
  • 1
  • 11
  • You need to set `isStretchWithOverflow="true"` one the TextField - frame will adjust accordingly - and `positionType="Float"` on all the elements below it. – Amongalen Mar 02 '20 at 12:45
  • I tried this for textFields at reportElement level. But this was not working. I am sorry the source that I Pasted here is not having them – Rajesh Kumar Mar 02 '20 at 14:43
  • I was still facing this problem and tried the workaround mentioned in post https://stackoverflow.com/questions/51517394/jasper-report-export-to-pdf-gives-exception-java-lang-classnotfoundexception-c But I still see the same problem. Finally after following the solution mentioned in https://community.jaspersoft.com/jasperreports-library/issues/12161 has resolved itext dependency issue which in turn solved the stretch problem as well. – Rajesh Kumar Mar 04 '20 at 09:17
  • I think you should post it as an answer to the question if you've managed to completely solve the problem. – Amongalen Mar 04 '20 at 10:03

0 Answers0