Jump to content
JasperReports Library 7.0 is now available ×

Info in Detail Band is more than 1 page


2004 IR Help

Recommended Posts

By: vtzeta - vtzeta

Info in Detail Band is more than 1 page

2005-12-08 10:00

how do i allow for the information in the detail band to flow onto a 2nd page? right now, i have "float" and "stretch with overflow" selected for each txt field but it won't flow onto more than 1 page. this is causing some wording to not display.

 

 

 

 

By: msprasanth - msprasanth

RE: Info in Detail Band is more than 1 page

2005-12-08 10:21

My experience.,

 

If you are looking in jasperviewer, then first export it to a PDF and see if its still not extending to second page.

 

Second, If its not extending to second page you might want to use groups to display ur report instead of just detail band. Using groups and resetting it for every row of ur result set will allow jasper to extend to a second page . The way jasper works is "if it doesnt find enough space on the current page for the current band, it will take a new page" .

 

There are samples at jasper home site. look for the scriplet example and open its JRXML file, u can see the groups and how they are defined.

 

Hope that helps.

 

 

 

 

By: jasperkan - jasperkannan

RE: Info in Detail Band is more than 1 page

2005-12-13 15:56

can someone please specify an example which uses grouping to display the spill over columns to the next page ? How should i specify groups to achieve this ? i have static text column header and some 16 columns which should be displayed in 2 pages .

 

any pointers will be greatly helpful.

thanks

 

 

 

 

By: jasperkan - jasperkannan

RE: Info in Detail Band is more than 1 page

2005-12-15 12:24

This is from http://jasperreports.sourceforge.net/tips.tricks.html#returnvalues

 

Bands larger than one page top

 

Sometimes the content of a particular report band is larger than one page and we have to find a way to force page breaks at certain points, inside the band structure.

 

Of course, this issue does not concern all the report bands. I imagine that we shall never have page or column headers or footers larger than one page ... but who knows?

 

If the title band or the summary band are larger than one page, you should consider placing their content into a subreport element and applying the following trick to this particular subreport. This might even work for the page or column headers, but never for the page or column footers, since the engine judge them to be of fixed height and do not perform stretch for the elements placed on those sections.

 

We have eliminated from our discussion some of the report sections and all that remains are the group headers and footers and the detail band.

 

The group headers and footers we'll be treated together, so let's start with the detail band.

 

If we have a detail band that contains so many elements on it that we have to split it on multiple pages, we have to find a way to introduce page breaks. But there is no such "page break" element available in JasperReports, so what to do?

 

The only way to deliberately introduce page breaks in JasperReports is by using the isStartNewPage attribute of the <group> element. We cannot use this to solve our problem.

 

Normally, the reporting engine starts a new page or column every time it sees that the band it has to fill does not fit on the remaining space on the current page. This is why we have that validation performed when the report design is compiled, so that the bands do not have a height greater than the page height. Without such a constraint, the reporting engine would get confused and behave uncontrollably.

 

So, in order to solve our problem, we have to find a way to somehow pass this band height validation check.

 

Well, we could do that by splitting the detail band content on multiple bands, each one of them smaller that one page, so that the report design remains valid.

And what other report bands could we use? Group headers and footers of course.

 

We could place some of our detail elements on a special group header, some of them will probably remain on the detail section, and the rest could go on the group footer. The only condition to this is that the group header and footer should always accompany our detail section, so that all three behave like a normal large detail band.

That's the easiest part, because we can introduce a dummy group that will break with every row in the data source. Such a group would have an expression like the following:

 

<groupExpression>$V{REPORT_COUNT}</groupExpression>

 

 

If one dummy group is not sufficient for you and you have a giant detail band, you could introduce as many dummy groups as you want to, all of them with the same dummy expression.

 

Problem solved.

 

Hey, we forgot about that other situation when one of the group headers or footers is larger than one page.

No problem. The solution is the same. You just have to introduce a new group, with the same expression as the one which poses the problem, and to split that group header or footer content between the two. Those two groups will break together and behave like one, so you can distribute the elements on their headers and footers as you want to.

The band height validation check could be passed this way.

 

 

 

 

 

 

By: Denny Valliant - xenden

RE: Info in Detail Band is more than 1 page

2005-12-15 17:20

That was a BEAUTIFUL post Jasperkan! Gonna add it to my "favorites". :-)

 

Thanks alot!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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