Jump to content
Changes to the Jaspersoft community edition download ×

Subreport data spacing problems


2006 IR Open Discussion

Recommended Posts

By: Jonathan - jonathan0000000

Subreport data spacing problems

2006-04-12 09:24

I have a complex report that contains many subreports. Sometimes data from later subreports gets printed before earlier subreports. This only happens when the later subreport detail is shorter than the earlier subreport detail.

 

Example report design:

------------------------------------------------

"PAGE "+$V{PAGE_NUMBER}

...some stuff that fills most of the page...

Subreport A

Subreport B

------------------------------------------------

 

If there is not enough space on the page to print an item from subreport A, I want the report to print like this:

------------------------------------------------

PAGE 1

...some stuff that fills most of the page...

 

PAGE 2

detail A1

detail A2

detail B1

detail B2

detail B3

------------------------------------------------

 

But if the detail items in subreport B are smaller than those in subreport A, it sometimes prints like this:

------------------------------------------------

PAGE 1

...some stuff that fills most of the page...

detail B1

 

PAGE 2

detail A1

detail A2

detail B2

detail B3

------------------------------------------------

 

The only way I have found to stop this behavior is to put a large space between subreports A and B, but then I always have this big empty space in the middle of the report.

 

Is there any other way to solve this problem?

Link to comment
Share on other sites

  • 4 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Have a look at http://www.jasperforge.org/index.php?option=com_mamblog&Itemid=109&task=show&action=view&id=228&Itemid=109 as it may provide some clues. Although the example discusses Text Fields the principles remain the same because subreports will automatically grow to accommodate all data.

 

 

So you don't need to worry about "Stretch With Overflow" as described in the example: it happens automatically.

 

 

What is important is that:

 

* the first subreport is Fixed Relative to Top

* subsequent subreports are set to Float

* all subreports are given a small vertical size (say 20 pixels) in the report design. JasperReports will automatically rezise them during the fill. If you try to guess the size that they need to be at design time you'll usually end up with layout problems in the report output.

 

 

.

Post edited by: jmurray, at: 2007/01/10 10:34

Link to comment
Share on other sites

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...