Tweaking an existing report template
Yesterday I looked at finding the existing report templates in iReport. Today I’ll modify one to create a better template.
Open classicT.jrxml in iReport 3.5. I want to make a few look-and-feel changes to get a nicer template.
- Reformat the title to use less space
- Change the background color in all group labels to white (transparent) and the font color to black.
- Change the default format for the date in the Page Footer. I want it to use Java’s MEDIUM format and to be appropriate for whatever locale the report is run in:
original: new Date()
modified: DateFormat.getDateInstance(DateFormat.MEDIUM, $P{REPORT_LOCALE}).format( new Date() )
Save the file as NeoClassicT.jrxml into the folder Templates somewhere on my harddrive. Also copy classicT.gif to NeoClassicT.gif.
The menu Tools -> Options opens the iReport options. The tab Wizard Templates allows me to add the folder “Templates”. I could add the jrxml file directly, but I prefer to add a folder so that additional templates will be picked up automatically.
Did it work?
Choose the menu File -> New… -> Report Wizard. Go through the wizard as usual, but on Step 7 I now see both the default template “Classic” and my new template “NeoClassicT”. Hooray.
If I were truly motivated I would modify NeoClassicT.gif to show a more accurate thumbnail of the template.
The file names are important. They must be “*T.jrxml” or “*C.jrxml”. iReport decides if they are columnar or tabular templates based on these names. Likewise, it matches up the thumbnail preview image based on name matching.
[…] Creating Report Templates in iReport « Blog Archive « Right Outer Join (tags: jasperreports , temp) […]
Pingback by links for 2009-04-30 | kerstins kleiner blog — 30 April 2009 @ 21:06
Cool! very helpful!
Comment by sridevi — 4 February 2010 @ 03:38
[…] you can get started customizing them for your own needs. You’ll find some tips in my article Creating Report Templates in iReport. Possibly related posts: (automatically generated)Report Templates in iReportcreate a Jasper Report […]
Pingback by Finding Report Templates in iReport 3.7 « Right Outer Join — 2 April 2010 @ 15:34
great info, thanks so much!
Comment by Jeff — 27 April 2010 @ 07:24