I have many reports in my project. I need to change the font that is displayed in the report. My .jrxml files contain about 20000 lines. It is difficult for me to change <font> tag for text element in all the .jrxml files. Is there a way that i can change the font of my reports without changing the .jrxml files??
I tried to use setFont() method on JasperViewer object. But it didnot work.
What about a small Java app that:
- load all your designs,
- parses each JasperDesign Object,
- create a new Style with your wanted font
- set this new Style to all textelements
- save the JasperDesign to JRXML
so you could later change the font again with just ONE statement for each JasperDesign
The best thing would be a external Style - but as I've never done this before, I can't give you a hint, but perhaps anyone else!?? :-)
External styles can indeed be used to keep in a single location style information that applies to multiple reports.
JasperReports includes under demo/samples/templates a sample report that illustrates how to use external styles.