Jump to content
Changes to the Jaspersoft community edition download ×

Page break preview scrambled


Recommended Posts

Hi All,


If been struggling with pagebreaks for quite a while now. Yesterday, after upgrading to iReport 1.3.0 I discovered the pagebreak/break element and hoped to end my misery in fiddling with the report groups.


Here's my observation. I created 3 reports which I'd like to print as subreports in a report; all 3 starting on a fresh page. Hence I place the subreports on the detail band and add 2 breaks, 1 between each.


When execute the report and preview, the report pops up in the previewer with the right amount of pages. However when I move through the pages, the preview starts getting messed up: the second report is drawn over the first, and the third over the both of them. Only when the next detail is hit, the page is cleared and a clean display of subreport 1 is seen.


Now I wonder:

- has anyone seen this effect before?

- will this effect disappear when really printing (not wasting trees yet)?

- Can I adapt the break element such that the effect disappears?

- Am I incorrectly using the break element?

- Is it a bug in the previewer?

- Is it a bug in the break element? (I've seen enthousiastic reports on its use only, so far... so I doubt it)



Thanks for any support,



size=297]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/irep131_overstrike.jpg size=150]

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Well for that purpose it should actually work. I would check following:


Is every element set to float within your detailband (so all subreports should be float.)

Secondly I would try to set the pagebreak element also to float (although I don't know if it's working somewhere in the middle of the band.... i just use it at the bandbottom)


So that's why you could also put the pageBreakElement within your summary band of the subreports.


So many tries... just post if some is working.


regards from Germany


Link to comment
Share on other sites

CBox, I am taking the liberty to post while none of your suggestions seems to solve my quest ;-)


Here's what I get: float on the page break does not seem to matter. I reduced my report to include only 2 subreports with a page brake inbetween. The first subreport is repeated on every page! By setting float=true on the subreports, the overstrike is gone. However, the 2nd subreport does not start at the top of the page, it starts just below the repeated 1st subreport!


No matter how I tweak the stretch or print repeated values flags, the result is: repeating subreport-1 and very short subreport-2's at the bottom of every page after the first page

(which leads to my next post: "sizing subreport elements")


My naive expectations of the break element are:

- report elements above the break are on pages before the pages that show the elements below the page break and never on the same page

- the elements immediately below the pagebreak will be printed as close to the top of a page as titles and headers permit


Now these may be completely out of line! Especially since my goofing around shows very different results. Where can I find the correct and official mechanics (except for the source)?

Link to comment
Share on other sites

I too have been fighting with the page break element with the same results that you have. I have temporarily worked around the page break issue by doing the following.


I have a master report that needs to print 5 subreports, with each subreport starting on a new page. I created 5 new dummy bands and placed a subreport on each one.


In each subreport except the last one, I set the summary band to a height of 1, and enable the "Print summary on new page" option under Edit->Report Properties->Other. This will force the report to end on a blank page, which becomes the first page for the next subreport since there is no page break between the subreports. You will need to play around with the position of subreports 2 through n to get the position of the top of the page to look right. I had to set mine to a top of -8.



1) This will not be a practical solution if you need to use the summary band for some other purpose.


2) If you are doing a Page X of N count in the subreport, the N will be actually 1 page more than the actual report needed. I solved that by using ($V{PAGE_NUMBER}.intValue -1) as the value for N on all reports except the last.


3) I have not tested this in all situations.



Link to comment
Share on other sites

my sentence "just post if some is working" should not mean, "do not post if it's not working".... i just meant that you should also reply the solution if some of my hints are working because many people here just leach information without answer and say: OK thanks, it's working!


(and that's why it's sometime hard to find a proper solution if you just search for a problem, find some hints but no response.... that is what I really dislike!)


So that is what I meant! :-)


Perhaps you could post your Reports (Master + Subs)... I can't really imagine that it's not working at all.


regards again


Link to comment
Share on other sites



I would by happily posting the failing design, but they require a compatible data source before you could try them. How would I go about that?


Meanwhile, I have abandoned the PageBreak approach. "Things" started to behave in a way I can control them by using the 1 pixel title page starting on a new page for every subreport. I am reasonably satisfied with that approach.


(I noticed something undesireable re. layout only recently: I don't understand the split allowed flag and it does not seem to control a band to run over the page end while it would fit on a single (new) page. This is a new topic, which I will search for in the forum before posting..)

Link to comment
Share on other sites

After playing with the page break element for a while I was finally able to get it to work.


Place the page break 1 pixel above the band bottom, set it to "Fixed relative to bottom" and it seems to work as expected. Any other configuration does not seem to work properly.



Link to comment
Share on other sites

Echo, C-Box,


You've made me so happy!


So, breaks need to be near the end of a band in order to work. If placed them at the appropriate band bottoms (which was awkward: iReport will place a break outside the band when aligning it with the band bottom - I think I'll submit a bug if it's not there yet) and set their position to float. That did it and my pages are broken now (pun intended)!


(I think fix relative to bottom and float combined with being positioned near a band bottom are equivalent).


Case Closed, I'd say! Thank you all!


In case you're an astronomer, please use the upcoming Integral Announcement of Opportunity to see beautiful JasperReports in action, live on a stage near you! ([url=http://integral.esa.int/] http://integral.esa.int )




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