Gustaf Posted July 13, 2007 Share Posted July 13, 2007 I have a report, it's fine. I now want to include a subreportinto a group I have defined myself. The subreport lies in itsown file subreport.jrxml and my main report is in mainreport.jrxml Including the subreport is not the difficult part. I have a successful connection to the subreport elements I want to get out.They are displayed inside my newgroup band, but the print orderdoes not remain horizontal. When I include the subreport the print order in the subreport is verticaland I would like to keep it horizontal - the way it is defined in the subreport. My master report's print order is vertical. How can I keep the subreport's print order ? Link to comment Share on other sites More sharing options...
Gustaf Posted July 13, 2007 Author Share Posted July 13, 2007 I did not see that the topic has been posted before. :unsure: Link to comment Share on other sites More sharing options...
codyjasperForge Posted July 14, 2007 Share Posted July 14, 2007 You might want to contact one of the admins for this one. I've searched around myself, but was unable to find anything relevant to this... It could also be a new feature ;) Please notify me if you get a reply. I would like to know a workaround as well. Link to comment Share on other sites More sharing options...
Gustaf Posted July 15, 2007 Author Share Posted July 15, 2007 I am very close to solving this, and I have a very good idea how to do it. I will get back asap when it's solved. Link to comment Share on other sites More sharing options...
Gustaf Posted July 18, 2007 Author Share Posted July 18, 2007 I promised to get back, I might not be able to fully explain into detail how we got it to work here, but hey that's why they invented posting in threads, I guess.. The first problem was getting the subreport to print horizontal and then keep this order when including the subreport into the master. Setting the print order did not work 100% in the subreport, unless I defined the subreport to print elements spanning more than 1 column. So I defined 2 columns in the detail band. I didn't need more than one band so I just collapsed the remaining bands that surrounded detail. Back in the main report I measured the width and height of the place of the subreport, so that my subreport would fit in there. I went back to the subreport and adjusted the height and width so it was ok. Also I zeroed the margins. No need for those. In my master report I clicked on the subreport button and expanded the subreport element to fit in where I wanted it. Once inside the subreport I added the following line in the Subreport tab : ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("MYPATH") I am using an XML datasource. Under Subreport Expresseion tab, I made sure the Jasper file path was correct.. I just punched in the absolute path to the file. After some hard tries it finally worked and it worked because the subReport parameter (up there) contained the right XPath expression. Working with the Xpath expressions can also take some time. Link to comment Share on other sites More sharing options...
codyjasperForge Posted July 18, 2007 Share Posted July 18, 2007 I'm glad you found a solution to this. Xpath huh...? interestingPost edited by: codyjasperForge, at: 2007/07/18 13:24 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