2.7 Templates

The topics in this section discuss the use of templates in Oracle Reports Builder.

2.7.1 About templates

Templates define common characteristics and objects that you want to apply to multiple paper-based reports. For example, you can define a template that includes the company logo and sets fonts and colors for selected areas of a report.

When you use the Report Wizard to create a paper-based report, you use the Templates page of the wizard to apply a template (.tdf file) to the report. The Templates page lists the default templates, as well as any templates that you have created.

Note:

If the list of templates does not appear, make sure that the REPORTS_PATH environment variable includes the location of the templates (for example, ORACLE_HOME\reports\templates).

When you choose a template, objects in the margin area of a template are imported into the same locations in the current report section, overwriting any existing objects. The characteristics (formatting, fonts, colors, and so on) of objects in the body area of the template are applied to objects in the body area of the current report section. Any template properties, parameters, report triggers, program units, and attached libraries you have defined are also applied. You can apply different templates to each section of the report. However, if you are applying one of the default templates, you cannot combine two report blocks that use different default templates in a single report. All of your report blocks in any one report must use the same default template.

If you later apply another template to a report, the existing template objects will be deleted in the current report section.

See also

Section 4.12, "Define a Template"

2.7.2 About template attributes

In the Layout Body area of a template, you can define Default and Override attributes under the following Object Navigator nodes:

  • Frames, which contains the following:

    • a Section Frame node, which defines attributes for the parent frame surrounding the currently selected section.

    • a Headings Frame node, which defines attributes for the parent frame surrounding the column headings.

    • a Fields Frame node, which defines attributes for the parent frame surrounding the fields.

    • a Summaries Frame node, which defines attributes for the parent frame surrounding the summaries (totals).

  • Field Labels/Headings, which contains the following:

    • a Character node, which defines attributes for the labels or column headings of character fields.

    • a Number node, which defines attributes for the labels or column headings of number fields.

    • a Date node, which defines attributes for the labels or column headings of date fields.

  • Fields, which contains the following:

    • a Character node, which defines attributes for character fields.

    • a Number node, which defines attributes for number fields.

    • a Date node, which defines attributes for date fields.

  • Summary Labels, which contains the following:

    • a Character node, which defines attributes for the labels of summaries on character fields.

    • a Number node, which defines attributes for the labels of summaries on numeric fields.

    • a Date node, which defines attributes for the labels of summaries on date fields.

  • Summaries, which contains the following:

    • a Character node, which defines attributes for summaries on character fields.

    • a Number node, which defines attributes for summaries on number fields.

    • a Date node, which defines attributes for summaries on date fields.

Default attributes

The Default node in the Object Navigator defines the default visual attributes (formatting, fonts, colors, and so on) for all report styles. If you want to define attributes for individual report styles, you do so under the Override node. When you apply a template to a report, all Default attributes are applied to the report, except for attributes that are localized under the Override node.

Override attributes

Under the Override node in the Object Navigator, you can define attributes for individual report styles. Each report style contains one or more sections that map to groups in the report:

Single-section report styles: Tabular, Form, Mailing Label, Form Letter

Multiple section report styles: Group Left, Group Above, Matrix, Matrix with Group

For the report styles that support multiple groups, you can create additional sections as needed. Sections are mapped to groups as follows:

Same number of groups as sections: one-to-one mapping (the first section is mapped to the first group, the second section to the second group, and so on).

More groups than sections: one-to-one mapping until the next-to-last section. Then, all subsequent groups are mapped to the next-to-last section, and the last group is mapped to the last section. If only one section exists, all groups are mapped to it.

More sections than groups: one-to-one mapping until the next-to-last group. Then, the last group is mapped to the last section.

See also

Section 4.12.2, "Defining default template attributes"

Section 4.12.3, "Defining override template attributes"

2.7.3 About applying templates

When you apply a template to a report, all of the following objects, properties, and attributes from the template are applied to the current report section:

  • parameters and their validation triggers

  • physical page size

  • logical page size

  • character/bitmap mode

  • margin position

  • panel print order

In addition, all of the layout objects in the margin of the template are copied into the same location in the current report section.

Usage notes

  • The template will be applied to the current section of the report (the section displayed in the Paper Layout view) by default. If no section is displayed, the template will be applied to the Main Section of the report by default. If you select the node for the entire report in the Object Navigator, the template will be applied to the Main Section of the report by default. To apply the template to a specific section of your report, select the node for that section in the Object Navigator.

  • You can apply different templates to each section of the report. However, if you are applying one of the default templates, you cannot combine two report blocks that use different default templates in a single report. All of your report blocks in any one report must use the same default template.

See also

Section 4.12.4, "Applying a template to a report"

2.7.4 About inheritance in templates

In templates, Sections, Frames, Fields, Labels, Headings, and Summaries properties all may inherit their values.

Default properties

The Default properties inherit the values preset by Oracle Reports Builder. When a property is set to its default Oracle Reports Builder value, the icon next to it in the Property Inspector is a small circle. Default properties become localized when you change their values, or select them and click the Localize Property button in the toolbar. When a property is localized, the icon next to it changes to a square. To return the properties to their inherited values, select the properties and click the Inherit Property button in the toolbar.

Override properties

The properties of Override Sections inherit their values from the Default properties. When a property inherits from a Default property, the icon next to it in the Property Inspector is an arrow. Properties in the Override Sections become localized when you change their values, or select them and click the Localize Property button in the toolbar. When a property is localized, the icon next to it changes to an arrow with a red cross through it. To return the values of properties in the Override Sections to their inherited values, select the properties and click the Inherit Property button in the toolbar.

2.7.5 About the Template Editor

The Template Editor is a work area in which you can define objects and formatting properties for your templates. It is similar to the Paper Layout view of the Report Editor. You can create, delete, and modify objects (for example, page numbers, text, and graphics) in the margin area. You cannot create and delete objects in the body area, but you can modify the properties of body objects in the Property Inspector (Tools > Property Inspector).

The Report Style list enables you to view the layout for a selected report style. To define default settings for all report styles, you can choose Default from the Report Style list. To make changes for an individual report style, you can select that report style from the Report Style list to specify settings that override the default.

Access

You can access the Template Editor in the following ways:

When creating a new template:

  • Choose File > New > Template.

  • In the Object Navigator, click the Templates node, then click the Create button in the toolbar.

When displaying an existing template:

  • From the Window menu, choose a window displaying Template Editor Paper Layout view.

  • In the Object Navigator, double-click the view icon next to the Paper Layout node for a template.