BIRT: Using the global library for styles, images etcBIRT libraries allow you to share themes (styles), images etc among many reports. I consider using the library a must for any project that involves more than one report and that share common styles etc simply because it makes my life a lot easier: If somebody requests a style change i.e., there is just one place where I have to change the style, not hundreds of reports!
Reference style from the library
- First create the styles in the project library: Click on the Navigator tab, choose your project, and if there isn’t already a library file available, create one by right clicking on the project name and choosing New > Library.
- With the library file open, switch to the Outline tab, right click on Themes and choose New * Theme. You can create as many themes there as you want. A theme is a collection of styles. Note that you can create both chart and standard report themes here. You can also copy the themes here from existing reports. Also note that you can import CSS styles from an existing file.
- To add styles to a standard theme, right click on your Theme and choose New Style.
- To use this global library, open your report, right click on Libraries in the Outline view and choose Use Library:
Choose the library that you want to reference.
- Chart Themes are available already when you configure a chart. But for the standard theme we have to take an additional step: In the Outline view select the report root element and then choose in the Properties view under General > Themes the theme you want to use:
- Now if you select one of the report elements and go the the style property, you will see styles listed from the external library.
- If you make changes to the external library, right click the root element in your report in the Outline tab and choose Refresh Library:
Referencing an image from the global libraryUsually you can just drag and drop an image from the Resource Explorer to your report. You will also release that in the Outline view the referenced image will be added to the Embedded Images - note the additional link symbol on the icon next to the image name:
Sometimes this doesn’t seem to work though, in example I experienced problems placing the library image in a grid. The workaround in this situation is to drag and drop the image from the Resource Explorer view to the Outline view into the Embedded Images folder:
Next drag and drop the image from the Outline view to your report.