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

前端 未结 2 2025
清酒与你
清酒与你 2020-12-19 11:01

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
相关标签:
2条回答
  • 2020-12-19 11:43

    Well it's bad news!! According to Jaspersoft's documentation on stretching fields it is not possible to stretch the width of a field:

    "Usually, the stretching process refers to the height adjustment only. When stretching report elements, adjusting the width could affect also the page width and raise unexpected errors at runtime (for instance, truncated information could be printed out on pages). This is why stretching an element let its width unchanged, while its height gets definitely enlarged in order to make room for all information that have to be displayed." (Jaspersoft documentation [v4.5.0], 2011)

    However a solution to the original issue can be found here thanks to @mdahlman

    0 讨论(0)
  • 2020-12-19 11:48

    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.

    0 讨论(0)
提交回复
热议问题