Search code examples
jasper-reports

Jasper report, approach to create table


I have to create the following table table to create

Where:

  • (Vx) means that it's a variable retrieved from a JSON dataset ($F)
  • Infox and SubInfox means it's a resource field ($R)

Actually i tried the Table and CrossTable components but they seem to be used for presenting recurring data (like sales per months...). What I also need it's that a line's size should dynamically change depending on the text size (coming from resource fields or variable fields).

Should i use rectangles component and lines component to obtain that result (which can be pretty long...)?


Solution

  • No. You should use the Stretch Type property with the value Relative to Tallest Object and Stretch With Overflow with the value true set to all the fields in your detail band. You should also set the Position Type property to float for all the elements in the detail band and all the elements in all the bands under the detail band. This will allow report rows to stretch as necessary. Note that this might not entirely work for XLS and XLSX, see Stretching of cell in XSL export of Jasper reports