saust Posted January 20, 2010 Share Posted January 20, 2010 Hi,I have a two page report with a subreport on each page. When both subreport are displayed everything works fine. However, when the second subreport is suppressed, I still get two pages one of which is blank. I use runToBottom=true for both subreports (so that they are on a seperate page with footers at the appropriate place), there's no space between the subreports or after the last one, and I checked remove Line When Blank. Anybody got an idea of what I am missing? I included part of the xml code below.Thanks, Ann. Code:<summary> <band height="12"> <subreport runToBottom="true"> <reportElement positionType="Float" x="0" y="0" width="540" height="6" isRemoveLineWhenBlank="true"/> ...... lots of parameters..... <subreportExpression class="java.lang.String"><![CDATA[$P{basePath} + "Darssa2ConsumerIntake_PFR1.jasper"]]></subreportExpression> </subreport> <subreport> <reportElement positionType="Float" x="0" y="6" width="540" height="6" isRemoveLineWhenBlank="true"> <printWhenExpression><![CDATA[$V{showDrugPage}]]></printWhenExpression> </reportElement> ...... more parameters..... <subreportExpression class="java.lang.String"><![CDATA[$P{basePath} + "Darssa2ConsumerIntake_PFR_drugs.jasper"]]></subreportExpression> </subreport> </band> </summary> Link to comment Share on other sites More sharing options...
rw-network Posted January 27, 2010 Share Posted January 27, 2010 Using JasperReport / iReport 3.7.0.I too am seeing an issue with a blank page coming out when using the 'Run to bottom' property on the subreport. When the 'Run to bottom' is true, the footer in the subreport comes out at the bottom of the page, but a blank page comes out after it. When the 'Run to bottom' is false, the footer in the subreport is not at the bottom of the page, but no blank page.Seems to be a bug in using the 'Run to bottom' property. It seems the Footer Position property also causes this 'bug'. Link to comment Share on other sites More sharing options...
saust Posted January 29, 2010 Author Share Posted January 29, 2010 Thanks for your input. I hadn't noticed a problem with the footer position.After many attemps, I also concluded that it seems to be a bug with runToBottom. It doesn't matter what the following suppressed item is (a suppressed label will cause the same problem). Perhaps the page break following runToBottom is evaluated before determining whether the following code should be printed or not? I ended up fixing the problem with 2 copies of my subreport, one with runToBottom=true used for multiple page reports and one with runtToBottom=false for one page reports. Of course, I then had a footer problem on the one page report, so I had to add it all to an extra top report file with a footer only used for the one page report. Ann. Link to comment Share on other sites More sharing options...
riesvantwisk Posted March 23, 2010 Share Posted March 23, 2010 I can second this on 3.7.1what do people do to solve this? I can only assume lot's of people would complain.... Is there already a know run-around? Ries Link to comment Share on other sites More sharing options...
dschafer Posted June 11, 2010 Share Posted June 11, 2010 Hi I haven't found a solution yet but the behavior seem to be very specific.If the actual output of the subreport is taller that the height of the subreport design element, then it will force a new page.I've tried various combinations of stretch and report size but no solution yet.-- Dave Link to comment Share on other sites More sharing options...
sudhi Posted November 18, 2010 Share Posted November 18, 2010 Code:I'm also facing the same problem did you find any solution. Pls.. let me know. Link to comment Share on other sites More sharing options...
teodord Posted November 20, 2010 Share Posted November 20, 2010 Hi, In the first case at the top of this thread, the blank page was probably caused by "an overflown with white space". The 6 white pixels resulting from the suppression of the second subreport, overflow onto the next page, because the first subreport was precisely big as a whole page. So the extra 6 pixels did not fit. Same thing probably happens in case the first subreport has runToBottom and it forces the remaining white space in its conaining band to overflow onto a new page. To avoid such problems, I suggest subreports to be placed in separate bands and to use the printWhenExpression of the band instead of the subreport element to suppress them.Note that a summary band could be split into multiple bands by using dummy groups footer bands. Groups that null or constant expression so they break only once per report. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
jacekplacek Posted December 18, 2013 Share Posted December 18, 2013 I think that i get this work. Setting height="0" for band and subreport element solved problem.<band height="0"> <printWhenExpression><![CDATA[$P{show1}]]></printWhenExpression> <subreport runToBottom="true"> <reportElement positionType="Float" x="0" y="0" width="595" height="0"/> ... </subreport> </band> <band height="0"> <printWhenExpression><![CDATA[$P{show2}]]></printWhenExpression> <subreport runToBottom="true"> <reportElement positionType="Float" x="0" y="0" width="595" height="0"/> ... </subreport> </band> ... Link to comment Share on other sites More sharing options...
siepaoling Posted February 24, 2014 Share Posted February 24, 2014 Yes, this is the solution. No need to use runToBottom for this to work. In the main report if you specify subreport height value other than 0, jasper report will still generate a blank area with that minimum height even if the subreport has no data. All subreports height will be accumulated with other group and section band heights, if the total height is greater than main report page height, jasper report will put the remaining element to next page which generates a blank page. Don't worry about setting subreport height=0, if subreport has data it will be displayed in main report and the height will be adjusted automatically. Link to comment Share on other sites More sharing options...
stlevkov Posted February 24, 2017 Share Posted February 24, 2017 I also make my code works with this example. Thanks @jacekplacek! Link to comment Share on other sites More sharing options...
diegobrandaosantos Posted September 6, 2021 Share Posted September 6, 2021 Thanks.Solved my problem setting subreports's height="0" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now