Jump to content
We've recently updated our Privacy Statement, available here ×

How to set left and width property of subreport dynamically using ireport 5.1


mousumib

Recommended Posts

I have a main report and two sub report which contains one cross tab in each. I want to set width and left property of both sub report in detail band dynamically which I will pass as a param to main report. In between both sub report there is a gap, how to remove it? Cross tab has dynamic no of columns. I can calculate the width of both sub report and set main report page width(total of both sub report) as per that calculated value and also pass those as param. Any help is appreciated. I have tried to set pageWidth and Left/Width property from param but that's not working.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Get idea from following post and done it.

https://community.jaspersoft.com/questions/1013551/dynamic-positioning-object-using-x-and-y-coordinates

Code snippet :

jasperPrint.setPageWidth(pageWidth);
JRPrintPage page = jasperPrint.getPages().get(0);
List<JRPrintElement> pageElements = page.getElements();
pageElements.get(3).setX(0);  
pageElements.get(3).setWidth(tab1Width);
pageElements.get(5).setX(tab1Width);  

pageElements.get(6).setX(tab1Width+tab2Width+10); 
pageElements.get(7).setX(tab1Width+tab2Width+90); 

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