iperdomo Posted May 7, 2008 Share Posted May 7, 2008 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 More sharing options...
lshannon Posted May 8, 2008 Share Posted May 8, 2008 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. HTHPost edited by: lshannon, at: 2008/05/07 19:07 Link to comment Share on other sites More sharing options...
iperdomo Posted May 8, 2008 Author Share Posted May 8, 2008 Hi lshannon, You point me in the right direction. I'm now using JRDesignLine and the getElementByKey() to set the width. Thanks a lot!! Best Regards, Iván 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