In BIRT 2.2, I would import a stylesheet and then apply the styles to my report. Unfortunately, this isn't very maintainable. Luckily Ben has found a solution to load styles from an external CSS file though there are contraints:
- You must use BIRT 2.3+
- Tag styling won't work-- for example, tr { color:red } will throw an error-- you have to give the style a name like .myrow { color:red }
- The stylesheet must be in the same Eclipse project (project references are not good enough) at design time-- you can load from another location after deploying the report
- Your style names must be all lowercase-- BIRT saves the names in your report as lower case even if they have uppercase characters and then they won't work once deployed
Here is the procedure:
- Upgrade Eclipse BIRT report designer to version 2.3.1
- If fixing an existing report, delete all currently used styles
- Right-click on "styles" in the outline, and choose "Use CSS file..."
- Choose your css file
- Check the box for "Include CSS file at view time" and enter
/path/when/deployed/your.css as the URI (note: this option is missing in BIRT 2.2; if you tried to upgrade 2.2 to 2.3 read my other blog entry about how this is basically impossible)
- There will be some errors if your css defines styles for tag names because BIRT doesn't like that. It only accepts class names. Just ignore it.
- Format the report by right-clicking and applying styles from your css
- Deploy the report
No comments:
Post a Comment