Rich Text Format (RTF) is a specification used by common word processing applications, such as MS Word. Template Builder provides easy-to-use wizards for inserting fields, tables, forms, charts, and cross-tabs. Also, Template Builder provides translation features and enables you to preview reports by using the template in supported formats.

This tutorial provides step-by-step procedures to use Template Builder to create RTF templates for Oracle BI Publisher reports. The examples will cover complex formatting and processing of reports by using these RTF templates. You will also learn how to work in both Online and Offline modes. Translating the RTF templates is covered in detail in the other tutorial -: Exploring Advanced Features of BI Publisher 11g, and also in the Instructor Led Training (ILT) for BI Publisher 11g.

Template Builder can be downloaded from the Get Started region of the Oracle BI Publisher Home page or Oracle BIEE Home page. In this topic, you will download the Template Builder add-in and install it.

Perform the following steps to download and install Template Builder:

.

Log in to Oracle BI Publisher.

.

In the Get Started section of the Home page, click the Download BI Publisher Tools menu, and select Template Builder for Word.

In this topic, you will review Template Builder UI components. You will open the existing Balanceletter.rtf file.

(This file is made available to you in the
My Templates and Files zip file, as well as in Sample after you install
the Template Builder.)

.

The BI Publisher ribbon has the following options:

Online
You can log in to BI Publisher from here. After you log in, you can use the Open button to open a report from the BI Publisher catalog.

Load Data
This group of commands enables you to load a saved sample data file or sample schema to Template Builder. You must load data to use most of the Template Builder functionality. The Sample XML button allows you to load a sample XML file that contains all the fields that you want to insert into your template as a data source. If you are not connected to the BI Publisher server, use this method to load your data.

Insert

This group enables you to insert the following elements into your RTF template.

Table Wizard: This function provides a wizard that guides you through the creation of tables used in typical reports.

Pivot Table: Using this you can drag and drop data elements into a pivot table.

Chart: BI Publisher does not recognize native Microsoft Word charts. The Insert Chart function allows you to insert a chart that is understood by Oracle BI Publisher.

ab|Field: This function allows you to select fields from your data source and insert them into your template

Table/Form: Use this function to insert data fields to be organized as a simple or nested table or as a form that is repeated with different data. You may even organize all the data fields for the whole document before inserting them.

Repeating Group: Use this to select or define a group of elements to be repeated for each occurrence of an element in the data.

Conditional Format: This enables you to define simple conditional formats to apply to table rows or cells.

Conditional Region: This enables you to insert a conditional statement around a region of the template. A conditional region is an area that is surrounded by a conditional statement. If the statement tests true, the area is displayed in the report; if the condition tests false, the area is suppressed from the report.

All Fields: This function inserts all fields found in the XML data into your document. It will also insert processing instructions into your document that will repeat a section, such as a table row when the associated XML element is repeated. When you are working on a deeply nested hierarchy of elements, it is better to insert elements separately, instead of inserting all fields.

Preview

This enables you to preview your RTF template with sample XML data. The preview menu offers you PDF, HTML, RTF, Power Point, Excel (MHTML format), and EXCEL2000 as output formats. When you select any of these output formats, Template Builder will merge the data into your template and create the output document.

Tools
This group has the following advanced editing tools for the templates:

Field Browser: This is for advanced users to review and edit BI Publisher commands inserted in the form fields. It shows the commands behind each form field and allows you to edit them. Use this tool to correct flawed RTF templates or to update multiple fields efficiently.

Validate Template: The validation function checks the template for incorrect use of BI Publisher commands and unsupported elements in the Word file.

Check Accessibility : Run this tool to check for the accessibility features in the template.

Translation: Extract Text: This command enables you to create a standard XLIFF translation file containing the boilerplate text from your template. XLIFF is a standard file format that is understood by many translation software packages. Because an XLIFF is an XML file, you can translate the text in a text editor. Preview Translation: This command enables you to preview your template as a PDF file using a specified XLIFF translation file. This functionality enables you to test translation files.Localize Template: This command applies a translation file to an RTF template. This means that in your current RTF template all boilerplate text is translated. The main function of this feature is to create a language-specific version of a template.

Export
XSL-FO Stylesheet: This function allows you convert the RTF template into an enhanced XSL-FO stylesheet. This function can be used to generate XSL-FO for debugging or further customization. FO Formatted XML: This function allows you to apply the XSL-FO style sheet generated from the Word document to the sample data and save the intermediate FO format. This function is mainly for debugging.PDF This function converts the Word document to PDF.

Options
This group allows you to change the following options that influence the look and feel of Template Builder:

Rich Text Format (RTF) is a specification used by common word processing
applications, such as Microsoft Word. When you save a template in Template Builder, the file type should be RTF. You can build and upload your template via a direct connection with the BI Publisher Server, called Online mode, or you can build and upload your template in a disconnected mode, and is called Offline mode.

Note: To work in disconnected mode, you must have a sample data file available in your local
work environment. In this example, the sample data file is Balance.XML.

This topic demonstrates how to design an RTF template while logged into BI Publisher.
You will log in to BI Publisher through Template Builder, define an RTF template, add a table with a running total, add grouping and sorting, add a page break, add a chart, preview data in the report by using the template, upload the RTF template to BI Publisher Enterprise Server, and view the report on BI Publisher Enterprise Server.

When the report opens, you will not see any data in the blank MS Word document.
However, XML data definitions are loaded from the report to facilitate the definition of a
template. Notice that the report name appears in the title bar of MS Word beside the
document name.

.

Now start building the template.

Insert a word table with two rows. Insert the chart in the first row, followed by the table in the second.

.

Now you will add a chart for this template. Position your cursor in the first row of the word table.
In the Insert group, click Chart.

.

The Chart window opens. Select Row in the Data pane.

.

a. Drag Annual Salary to Values in the Layout pane.b. Drag Department Name to the Labels text box.

.

In the Layout pane, select the following information:

Step

Attribute

Values

a.

Type

Bar Graph - Vertical

b.

Style

Earth

c.

Aggregation

Average

f.

Title:Title

Average Annual Salary by Department

The Chart wizard should look like this:

Click OK.

.

The chart appears in the template.

.

Now use the Table wizard to insert the table in your template. You did this in the previous topic, but in Offline mode. Take your curser to the next row of the MS Word table, and then insert the table.

a. Select Department Name,Manager, Name, Job Title, Annual Salary, and Fed Withheld (in that order). Your selections should be listed in the right pane of the wizard page.

b. Click Next.

.

In the How would you like to group your report? section, select the following options:

Group By - Department Name

Group Above

Break - Section

Then By - Manager

Group - Left

Recall that while working on the table in the Offline mode, you did not choose options for grouping. This example uses section breaks in the report with Department Name as the group and has a second grouping by Managers.

Click Next.

.

Sort by Annual Salary in the Which fields would you like to use to sort the data? section. Click
Finish.

.

This table appears in the document, below the chart. Right-justify the cell for ANNUAL_SALARY.

.

Save the file as Manager Financials Report.rtf in your Learn folder.

.

Select the PDF preview option from the Preview group. The PDF is displayed. Observe that because you used the “Group above” option while inserting the table, a
department name appears above each table.

This topic covers adding a pivot table to an existing RTF template. You will open an existing RTF template to preview a chart, and add a pivot table to the template. The RTF template Retail Sales.rtfis stored in the My Templates and Files zip file.

.

Open the Retail Sales.rtf file in MS Word. The file looks like this:

.

In the BI Publisher ribbon, click Sample XML in the Load Data group.

.

Navigate to and selectRetailSales.xml(located in the same folder as the Retail Sales RTF template), and click
Open. This file contains retail sales data from different
industries.

This topic will demonstrate how to use the Field Browser, Check Accessibility, and Validate Template utilities available in Template Builder.
You will use theRetail Sales.rtffile, which is made available to you at My Templates and Files zip file.

The Field Browser utility provides a fast way to review and update the BI Publisher instructions hidden in the Microsoft Word form fields. This is particularly useful for understanding and modifying existing templates.

.

In the BI Publisher tab, in the Tools group, click Field Browser to open the Field Browser dialog box.

.

The Field Browser dialog box shows the default text of the form field in the Text column, and the instructions (from the help and status text of the form field) in the Code column.

Note:

When you select a specific row in the dialog box, the matching form field will be selected in the Microsoft Word document.

If you select some part of the text before opening the Field Browser, the dialog shows only the fields in your selection. If no text is selected, Field Browser will show all fields in the document. This screenshot shows all the fields, because no specific form field was selected before opening Field Browser.

.

You can update processing instructions directly from the Field Browser dialog box.

a. Select INDUSTRY in the Text column..

The Edit field shows the processing instructions.

b. Change all but the first of the capital letters of the word INDUSTRY to lowercase. In other words, change INDUSTRY to Industry.

c. Select Update.

Observe that the code is changed as per your edit.

Note: Recall from the previous topic that you can use Field Browser to find out validation errors in the template. Use the Find option in the Field Browser to search for the errors.

Template Builder provides an accessibility checker to check the template for features to enhance the accessibility of the report for report consumers who may need assisting technologies to view the report. For more information about developing accessible reports, see "Designing Accessible Reports" in the Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher.

.

In the BI Publisher tab, in the Tools group, click Check Accessibility.

.

The tool generates a report indicating areas of your template that do not include the accessibility features.

This template does not have accessibility compatibility for a row header of a table.

For more information about developing accessible reports, see Designing Accessible Reports" in the Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher.

The Preview tab allows you to specify options that influence the Preview functionality of Template Builder.

The various options that you can set using this dialog are:

Style Template

Locale

Java Home

Java Option

Style Template

If you have a BI Publisher style template available locally you can specify it here. The style information in the style template is applied to RTF layouts at runtime to achieve a consistent look and feel for your enterprise reports. In this example no style template is defined.

For more information, see "Creating and Implementing Style Templates" in the Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher.

Locale

You can choose the language and territory used for previewing your template. While this change will not automatically translate any files, it is important to set the correct locale for the preview to use the correct direction of the text (left-to-right or right-to-left), and to correctly set locale-specific date, number, and currency formats. In this example the Locale is set to English - United States [en-US]

Java Home

The Preview (and export functionality) requires Java code. You can change the path to your JAVA HOME directory. If this option is not specified, Template Builder assumes that the Java virtual machine (java.exe) is accessible in the PATH specified in your environment variables of Windows. In this example it is set as C:\Program Files\Java\jre6

Java Option

Specify the memory to reserve for Template Builder to process the template. The default value is -Xmx256M. The example shows the same.

Use the Build tab to specify options that influence how Template Builder generates tables and forms.

The various Build options that you can set here are:

For-each form field

Form field size

Table Header Color

For-each form field

Use this to choose how the Template Builder creates the form fields for processing instructions in the Insert Table/Form dialog box. The Descriptive option (for example: for-each Invoice) renders a descriptive form field for the processing instructions. This option makes the layout template easier to understand. However, the longer fields may distract from the visual layout of the template. The Abbreviated option (for example: F) provides a one letter abbreviation for each instruction.

Select the Hidden option to generate the processing instruction form fields using Microsoft Word's hidden font effect. Hidden text is hidden in the print preview. You can display or hide the hidden text by selecting or deselecting the “Hidden text” option in the Display options of Microsoft Word Options.

Form field size

The Large option inserts the BI Publisher code in a document variable. The document variable field can accommodate approximately 48 kilobytes of code line.

Note that this setting affects only fields that are created or edited while this option is set.

Table Header Color

When you insert a table by using the Table Wizard or the Insert Table/Form dialog box, the Template Builder applies the table header color specified here to the table header background. Use this feature to customize the default color for your templates.

Generate XSLT 2.0 compliant code

BI Publisher uses the XSLT processor provided by Oracle XDK 11.1.0.7.0, which supports the W3C XSL Transformations 1.0 recommendation. The processor also
implements the current working drafts of the XSLT and XPath 2.0 standards. For more information about Oracle XDK see Oracle XML Developer's Kit Programmer's Guide 11g.

By default, BI Publisher is compatible with XSLT 1.0. If you wish to use XSLT and XPath 2.0 features in your template enable this option. This configuration is performed at the template level. The template-level setting will override the server setting.

This concludes the "Setting Configuration Options for Template Builder" topic.