2006 IR Open Dicussion Posted August 26, 2006 Share Posted August 26, 2006 By: Pushkar Angina - pushkar_angina Setting style at run-time 2006-01-17 05:02 I am using iReport 0.5.3 with JasperReports 1.1.1. I have defined a style in my report using iReport and applied it to some text fields (let's call this style 'col_header'). When I run the report from my java program, it works well and also shows the text fields with the applied style. Now, is there a way, where I can get col_header style from report during run-time and modify some of it's properties. I have tried the following way, but this did not work. It still shows the text fields with earlier style. Basically I want to externalize the style for my reports(similar to css in HTML). Any help on this will be greatly appreciated. //Code Snippet JasperPrint jasperPrint = jasperPrint(dataSource, reportParameters, templateLocation); JRStyle style = jasperPrint.removeStyle("col_header"); //Altering few properties in style style.setFontSize(12); style.setForecolor(new Color(50,50,50)); //Adding the modified style to the report jasperPrint.addStyle(style); JasperExportManager.exportReportToPdfFile(jasperPrint, "/sample.pdf"); // By: Lucian Chirita - lucianc RE: Setting style at run-time 2006-01-17 06:53 This was rather a bug. The print element templates were not referencing the same JRStyle objects as the ones in JasperPrint. The fix is available on CVS (look for net/sf/jasperreports/engine/fill/JRFillElement.java rev 1.26). Regards, Lucian 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