Jump to content

Modifying static element in runtime


iperdomo

Recommended Posts

Hi all,

 

I have a template (template.jrxml) and I want to modify static element (a line) in runtime.

 

My problem: the page width is increased/decreased based on the number of columns that I want to show in my report. Everything is working fine, but the line in my header band, if the page width grows more than the line's defined width, I got a ugly blank space in the header.

 

Is possible with JasperDesign class access the line element and modify the width on runtime? If is possible how can i do it? If not, do you have a workaround?

 

Best Regards,

 

In advance,

 

Iván

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I have done something like this.

 

Here is a snippet where I did something similar (I just ripped this out of some other code so not all the variables are defined but I think you can get the picture):

Code:

File sourceFile = new File(filePath);
JasperReport jasperReport = null;
try {
jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);
JRFrame data_frame = (JRFrame)jasperReport.getTitle().getElementByKey("data_frame-2"«»);
data_frame.setX(level * 10);
}
} catch (JRException e) {
log.error(e);
}
return jasperReport;

 

Let me know if you have any questions.

 

HTH

Post edited by: lshannon, at: 2008/05/07 19:07

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