How to stretch a text field relative to data width in Jasper Reports

fieldjasper-reportsstretch

I have a text field followed by a static text field and I am trying to do 2 things with it:

  1. Get the text field to stretch horizontally (not wrap) when text is longer then the field width and
  2. Push the static text field right when the text field to the left of it stretches

Both of the fields are contained within a frame.

I have both fields set to positionType=float and the text field set to stretchWithOverflow=true, which enable text to wrap vertically but not stretch horizontally.

Is it possible to achieve 1 and 2 above? If so How?

Best Answer

Instead of having 2 text fields (dynamic and static), you can have 1 text field with value as $F{Field} + "statix text". This will probably fix your issue. Also, you can set the "width" and "stretch with overflow" properties, as per your requirements.

Related Topic