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

Copying design from one band to another


Recommended Posts

By: Christiaan - christiaan_se

Copying design from one band to another

2006-02-16 06:50

Hi,

I want to copy the design of a band of one report to another report.

 

I currently have the following code, which seems to work fine, but I was wondering if need to call getCopy() instead of adding the JRDesignElement right away. If so, I need to pass in a JRAbstractObjectFactory, how can I retrieve one?

 

private void replaceBand(JRDesignBand originalBand, JRDesignBand newBand) {

if(newBand.getElements().length > 0) {

for(JRElement element : originalBand.getElements()) {

if(element instanceof JRDesignElement) {

JRDesignElement designElement = (JRDesignElement) element;

originalBand.removeElement(designElement);

}

}

originalBand.setHeight(newBand.getHeight());

for(JRElement element : newBand.getElements()) {

if(element instanceof JRDesignElement) {

JRDesignElement designElement = (JRDesignElement) element;

originalBand.addElement(designElement);

}

}

}

}

 

kind regards,

Christiaan

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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