Jump to content
Changes to the Jaspersoft community edition download ×

Make a subreport use the same height as its master


Xecu

Recommended Posts

Hi,
I am struggling with a report that should spawn a table where each row can have 1 or more subrows. I solved this by using this structure:

  • Master renders the tableheaders, creates each row via Subreport A
  • Subreport A renders each row, creates each subrow via Subreport B
  • Subreport B renders each subrow

By default, each row is 17px in height, but can get taller if the content is causing a linebreak in a table-cell. If this happens in Subreport A, then Subreport B is not stretching itself to keep up with Report A´s height. In the end, Subreport A creates a row with ,e.g. a height of 25px, while Report B´s row is only 17px height, resulting in a small gap. Does anyone know how to make Report B stretch with Report A ?

What i tried so far:

  • Playing with the strech-options of both subreports
  • Copying the line-breaking text of report A to report B. Sadly, this is not an option anymore.
  • Using the Table-element instead of Subreport B. Same issue.

In the image below, the first 2 columns are part of Subreport A and the last 2 columns are part of Subreport B

jasper_row_problem.png.a10f86b081f15c949e0b923f8a6774aa.png

 

Edit: Fixed Question styling

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Hello Buddy 

What I understood from your graphical presentation is that the dates are coming from some subreport. So what you can do is just select your subreport and set the following properties stretch with overflow = true and also select from the dropdown "Relative to tallest Object " from the stretch type property.

 

Thanks

Honey

Link to comment
Share on other sites

Thanks for the quick response. I tried that, but could see no change in the rendered pdf.

Also, all elements in Subreport B (the one with the dates) are set to stretch with the tallest object.

I think the problem is, that the elements and bands in Subreport B dont know, that their reports height has changed, and thus still think their band / biggest items have the default height of 17px.

Link to comment
Share on other sites

Hello I have also faced similar problem some days before.

What you should do is pass the main report column a in your output as a paramter to the subreport and similarly from report b the second column to its

subreport.Place these parameter in a text field and send them back in subreport.Make sure that they have same width as in the main report.

Then put strech type as relative to tallest object you will get the desired output.

Link to comment
Share on other sites

If I understood you correctly, you mean i should copy the height-stretching textfield of the master-report and insert it with the same width in the subreport? That was my initial solution, but the problem is that the copied text is still rendered in the finished pdf. It might not be visible there, but it is still searchable and selectable. If it were not for these 2 issues, this solution might be viable for me again.
Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...