Creating a library
BIRT Report Designer provides the following three ways to create a library:
*Creating a library from an entire report design
Use this technique if a model report design exists that contains a strong base of report elements having a desirable structure, properties, and styles. In the Outline view, right-click the report design root, shown in Figure 29‑2, and choose Export to Library. All report items in the Body slot in the report design now appear in the Report Items slot in the new library. The report design’s custom styles appear in the defaultTheme theme in the library’s Themes slot. Other elements appear in the same slot in the library as in the report design.
Figure 29‑2 Comparing a report design outline and a library outline
*Creating an empty library
Use this technique to develop a set of related report elements that do not depend on existing report designs. Choose FileNewLibrary. BIRT Report Designer creates the new library in a folder in the current workspace.
*Creating a library from individual report elements
Use this technique if model report elements having desirable properties, structure, and style exist in multiple separate report designs. In the Outline view, right-click the report element and choose Export to Library. Provide a name for a new library or select an existing library in the resource folder.
Developing library report elements
After creating a library, you begin to build a library framework by adding report elements to the library. This process is similar to developing elements in a report design. To create or edit a data source, data set, data cube, or report parameter, use the same Data Explorer wizards and dialogs in the library as in a report design. To add a visual report item, drag an item from the palette to the layout editor. The new item appears both in Report Items in the Outline view and on its own page in the layout editor, as shown in Figure 29‑3. To edit an existing report item in a library, select the item in Report Items in the Outline view.
Figure 29‑3 Library report item outline and appearance
Grouping library styles into a theme
A library provides a flexible way to share sets of styles by grouping styles into themes. Each theme supports the complete set of styles used in a report design. The Outline view of a library shows Themes where the outline of a report design shows Styles. In a newly created library, Themes contains one theme named defaultTheme. During the development of report items in a library, BIRT Report Designer displays the items using styles in this theme.
A library developer chooses the properties, such as the set of colors to use in the styles in each theme. For example, first, he creates the report style that contains the background color, border, and font properties for all items. Next, he designs a table header style using the same color palette so that each table’s header stands out from the rest of a report but the appearance does not clash with the other report items.
To create a new theme, in Outline, right-click Themes and choose New Theme. For example, provide styles in defaultTheme for use in most report designs. Then, make special themes for financial and marketing report designs, as shown in Figure 29‑4. A report design uses styles from only one theme. If some styles must be the same for all themes, copy the styles from one theme to the other themes that need those styles.
Figure 29‑4 Multiple themes in a library
Comparing themes and CSS files
Both themes and CSS files provide shared styles. Use a CSS file when your company already has a standard set of styles in a CSS file or if your report developers are familiar with using CSS. Use a theme from a library instead of a CSS file to group related styles together or to use more style properties than BIRT supports in CSS.