Jump to content

Subreport print order


Gustaf

Recommended Posts

I have a report, it's fine. I now want to include a subreport

into a group I have defined myself. The subreport lies in its

own 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 order

does not remain horizontal.

 

When I include the subreport the print order in the subreport is vertical

and 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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

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

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