How to change font??

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.

anila's picture
Joined: Dec 3 2008 - 9:26pm
Last seen: 14 years 9 months ago

2 Answers:

What about a small Java app that:

  1. load all your designs,
  2. parses each JasperDesign Object,
  3. create a new Style with your wanted font
  4. set this new Style to all textelements
  5. 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!??  :-)




C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 3 weeks 5 days ago

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.



lucianc's picture
Joined: Jul 17 2006 - 1:10am
Last seen: 12 hours 20 min ago