ktrinad Posted August 19, 2006 Share Posted August 19, 2006 By: Vincent Hikida - vhikida Page Breaks Between Subreports 2003-12-30 12:50I am now able to create a report with 3 subreports using the hints at http://sourceforge.net/forum/message.php?msg_id=1609974 I am trying to create have a page break at each new subreport. The strange thing is that the second subreport starts on a new page. However, I haven't been able to get my 3rd subreport to start on a new page. The first subreport and second subreport have exactly the same report element that is: <reportElement x="5" y="25" width="325" height="20" backcolor="#FFCC99" isPrintRepeatedValues="false" isPrintWhenDetailOverflows="false" isRemoveLineWhenBlank="true" positionType="Float"/> If I create the third subreport with the same report element, it overwrites the second subreport. If I change the the 3rd element to y="50", it will float after the second subreport but it will not start on a new page. Is there a way to do this? Why does the 2nd subreport act differently than the 3rd? By: Vincent Hikida - vhikida RE: Page Breaks Between Subreports 2003-12-30 23:04OK. I finally got it through my thick skull that you are not supposed to have that much control over page breaks in Jasper. However, I think I've come up with a trick that seems to work. The example is roughly based on the Subreport sample. In my "Master" XML I do the following query SELECT id FROM ids WHERE id IN (1,2) In master I then create a group <group name="IdGroup" isStartNewPage="true"> <groupExpression> $F{id} </groupExpression> </group> I pass id as a parameter to both Address.xml and Product.xml. In Address.xml I do the following SELECT * FROM address WHERE 1 = $P{id} In Product.xml I do SELECT * FROM product WHERE 2 = $P{id} This seems to be working in my test. I am now going to try the same on a much more complicated report tomorrow. I have only been working with Jasper for a couple of weeks but I get the feeling that I'm missing some fundamental concept. While I was playing with subreports in my more complicated test, I was getting the page header of one subreport on all my pages. This was pretty confusing. It seems that subreports should be self contained except for whatever parameters are passed. By: Harish - harishhebbar How to include the subreport path in Claspath 2004-01-12 22:00hi Vincent Hikida, I was going through the subreports. While including the subreport , if i dont want to hardcode the path , what can be done. Do i need to include in Classpath. <subreport> <subreportExpression class="java.lang.String"><![CDATA["c:/Reports/BillingReport2.jasper"]]></subreportExpression> </subreport> Please can u help me out. Thanks. By: Vinod Kumar Singh - vinodsingh RE: Page Breaks Between Subreports 2004-01-13 20:25You can do like- <subreport> <subreportExpression class="java.lang.String"><![CDATA["com/foo/Reports/BillingReport2.jasper"]]></subreportExpression> </subreport> make sure it is in your classpath (the jar file containing report) vinod By: Harish - harishhebbar RE: Page Breaks Between Subreports 2004-01-13 20:52hi vinodsingh, Thanks for the reply . Infact i managed calling the subreport as parameter by using like this. <subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{paramreport}]]></subreportExpression> Thanks. 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