11 Creating and Implementing Style Templates

A style template is an RTF template that contains style information that can be applied to other RTF layouts to achieve a consistent look and feel across your enterprise reports.

This chapter describes how to create and implement style templates. It includes the following sections:

11.1 Understanding Style Templates

A style template is an RTF template that contains style information that can be applied to RTF layouts. The style information in the style template is applied to RTF layouts at runtime to achieve a consistent look and feel across your enterprise reports. You associate a style template to a report layout in the report definition. Using a style template has the following benefits:

  • Enables the same look and feel across your enterprise reports

  • Enables same header and footer content, such as company logos, headings, and page numbering

  • Simplifies changing the elements and styles across all reports

11.1.1 About Styles Defined in the Style Template

The styles of the following elements can be defined in the style template:

11.1.1.1 Paragraph and Heading Styles

You can create a paragraph style in a style template. When this same named style is used in a report layout, the report layout inherits the following from the style template definition: font family, font size, font weight (normal, bold), font style (normal, italic), font color, and text decoration (underline, overline, or strike through).

11.1.1.2 Table Styles

Following are some of the style elements inherited from the table style definition: font style, border style, gridline definition, shading, and text alignment.

11.1.1.3 Header and Footer Content

The header and footer regions of the style template are applied to the report layout. This includes images, dates, page numbers, and any other text-based content. If the report layout also includes header and footer content, then it is overwritten.

11.1.2 Style Template Process Overview

Design Time

For the Style Template:

  1. Open Microsoft Word.

  2. Define named styles for paragraphs, tables, headings, and static header and footer content. This is the style template.

  3. Save this document as a .rtf file.

  4. To ensure that you do not lose custom styles in Microsoft Word, also save the document as a Word Template file (.dot) or save the styles to the Normal.dot file. This file can be shared with other report designers.

  5. Upload the RTF style template file to the catalog.

For the layout template using the style template:

  1. In the RTF template, use the same named styles for paragraph and table elements that you want to be inherited from the style template.

  2. Open the report in BI Publisher's Report Editor and select the style template to associate to the report. Then enable the style template for the specific report layout.

Runtime

When you run the report with the selected layout, BI Publisher applies the styles, header, and footer from the style template.

11.2 Creating a Style Template RTF File

The following sections describe how to define the style types in the Microsoft Word document. For more complete information see the Microsoft Word documentation.

11.2.1 Defining Styles for Paragraphs and Headings

Use a paragraph style to define formatting such as font type, size, color, text positioning and spacing. A paragraph style can be applied to one or more paragraphs. Use a paragraph style to format headings and titles in the report as well.

To define a paragraph style type:

  1. In the Microsoft Word document, from the Format menu, select Styles and Formatting.

  2. From the Styles and Formatting task pane, select New Style.

  3. In the New Style dialog, enter a name for the style. Choose style type: Paragraph. Format the style using the options presented in the dialog. To see additional paragraph options (such as font color and text effects), click Format.

  4. When finished, click OK and the new style is displayed in the list of available formats in the Styles and Formatting task pane.

  5. Choose the new style and make an entry in the style template to display the style.

To apply the paragraph style type in the document:

  1. Position the cursor within the paragraph (or text) to which you want to apply the style.

  2. Select the style from list of available formats in the Styles and Formatting task pane. The style is applied to the paragraph.

To modify an existing style type:

  1. In the Microsoft Word document, from the Format menu, select Styles and Formatting.

  2. From the Styles and Formatting task pane, select and right-click the style to modify.

  3. From the menu, select Modify.

11.2.2 Defining Styles for Tables

To define a table style type:

  1. In the Microsoft Word document, from the Format menu, select Styles and Formatting.

  2. From the Styles and Formatting task pane, select New Style.

  3. In the New Style dialog, enter a name for the style. Choose style type: Table. Format the style using the options presented in the dialog. To see additional table options (such as Table Properties and Borders and Shading), click Format.

  4. When finished, click OK and the new style is displayed in the list of available formats in the Styles and Formatting task pane.

  5. Choose the new style and make an entry in the style template to display the style.

To apply the table style type in the document:

  1. Position the cursor within the table to which you want to apply the style.

  2. Select the table style from list of available formats in the Styles and Formatting task pane. The style is applied to the table.

11.2.3 Defining a Header and Footer

You can define a header and footer in the style template. The contents and sizing of the header and footer in the style template are applied to the report layouts.

Important:

If a header and footer have been defined in the report layout, then they are overwritten. The header and footer from the style template are applied.

To define a header and footer:

  1. In the Microsoft Word document, from the View menu, select Header and Footer.

  2. Enter header and footer content. This can include a logo or image file, static text, current date and time stamps, page numbers, or other content supported by Microsoft Word.

11.3 Uploading a Style Template File to the Catalog

You can place a style template in any folder in the catalog to which you have access. Your organization may have a designated folder for style templates.

To upload a style template file:

  1. On the global header click New and then click Style Template. This launches an untitled Style Template properties page.

  2. From the Templates region, click the Upload toolbar button.

  3. In the Upload Template File dialog (shown in Figure 11-1), use the Browse button to select the Template File. Select rtf as the Type, and select the appropriate Locale, as shown in Figure 11-2. Then click OK.

    Figure 11-1 Upload Template File Dialog

    Description of Figure 11-1 follows
    Description of "Figure 11-1 Upload Template File Dialog"

    Figure 11-2 Select the Appropriate Locale

    Description of Figure 11-2 follows
    Description of "Figure 11-2 Select the Appropriate Locale"

    The style template file is displayed in the Templates region as the locale name that you selected (for example: en_US).

  4. Click Save.

  5. In the Save As dialog choose the catalog folder in which to save the style template. Enter the Name and click Save.

    Note:

    You may only upload one RTF file per locale to a Style Template definition. If you upload additional template files to this Style Template, each file is automatically named as the locale regardless of the name that you give the file before upload.

  6. If you are uploading multiple localized files, then select the file that is to be used as the default. For more information on localization of template files see Section 11.6, "Adding Translations to a Style Template Definition."

11.4 Assigning a Style Template to a Report Layout

To assign a style template to a report layout:

  1. Navigate to the report in the catalog and click Edit to open the report editor.

  2. From the default thumbnail view, select View a List. In the Layout Region, click the Choose icon to search for and select the style template from the BI Publisher catalog.

  3. For the layout templates that you want to use the style template, select the Apply Style Template box for the template. Note that the box is only enabled for RTF templates.

Figure 11-3 shows the actions required to enable a style template in the Report Editor.

Figure 11-3 Enabling a Style Template in the Report Editor

Description of Figure 11-3 follows
Description of "Figure 11-3 Enabling a Style Template in the Report Editor"

11.5 Updating a Style Template

To update or edit a saved style template:

  1. Navigate to the file in the catalog.

  2. Click Edit to open the Style Template properties page.

  3. Delete the existing file.

  4. Upload the edited file, choosing the same locale.

11.6 Adding Translations to a Style Template Definition

Style templates offer the same support for translations as RTF template files.

You can upload multiple translated RTF files under a single Style Template definition and assign the appropriate locale. These are displayed in the Templates region, as shown in Figure 11-4.

Figure 11-4 Templates Region

Description of Figure 11-4 follows
Description of "Figure 11-4 Templates Region"

Or you can generate an XLIFF (.xlf) file of the translatable strings, translate the strings, and upload the translated file. These are displayed in the Translations region, as shown in Figure 11-5.

Figure 11-5 Translations Region

Description of Figure 11-5 follows
Description of "Figure 11-5 Translations Region"

At runtime, the appropriate style template is applied based on the user's account Preference setting for Report Locale for reports viewed online; or, for scheduled reports, based on the user's selection for Report Locale for the scheduled report.

The XLIFF files for style templates can be generated individually, then translated, and uploaded individually. Or, if you perform a catalog translation that includes the style template folders, the strings from the style template files are extracted and included in the larger catalog translation file. When the catalog translation file is uploaded to BI Publisher, the appropriate translations from the catalog file are displayed in the Translations region of the Style Template definition.

For more information on translations, see Chapter 15, "Translation Support Overview and Concepts."