This topic describes creating RTF templates using the Template Builder for Word add-in.
Topics:
The Template Builder is an add-in to Microsoft Word that simplifies the development of RTF templates.
While the Template Builder is not required to create RTF templates, it provides many functions that increase productivity.
The Template Builder is tightly integrated with Microsoft Word and enables you to perform the following functions:
Insert data fields
Insert tables
Insert forms
Insert charts
Preview the template with sample XML data
Browse and update the content of form fields
Extract boilerplate text into an XLIFF translation file and test translations
The Template Builder automates insertion of the most frequently used components of an RTF template. RTF templates also support much more complex formatting and processing.
The Template Builder installation provides samples and demo files to help you get started.
The demos can be accessed from the Windows Start menu as follows:
Select Start, Programs, Oracle BI Publisher Desktop, and Demos.
You can also access the demos from the BI Publisher\BI Publisher Desktop\demos folder where you installed BI Publisher Desktop (for example: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\demos
).
The following demos are provided:
TemplateBuilderDemo.exe - Demonstrates building a report layout using many key features of the Template Builder, including: connecting to the BI Publisher server, loading data for a report, inserting tables and charts, and defining conditional formatting.
TemplateBuilderInvoice.exe - Demonstrates how to take a prepared layout and use the Template Builder to insert the required fields to fill the template with data at runtime.
LocalizationDemo.exe - Demonstrates the localization capabilities of the Template Builder and shows you how to extract an XLIFF file from the base RTF template. The XLIFF file can then be translated and the translations previewed in the Template Builder.
The sample files are located in the BI Publisher\BI Publisher Desktop\Samples folder. The Samples folder contains the subfolders:
eText templates
Excel templates
PDF templates
RTF templates
The eText, PDF, and Excel template samples can be used as references to create these types of templates. The Template Builder is only available for the RTF templates. The RTF templates folder contains eight subfolders to provide samples of different types of reports. Refer to the TrainingGuide.html located in the RTF templates folder for additional information on what is contained in each sample.
Certain prerequisites and limitations apply to this feature.
Prerequisites
The report data model created and running successfully.
Supported versions of Microsoft Word and Microsoft Windows are installed on the client.
The BI Publisher Template Builder downloaded and installed on the client.
The Template Builder can be downloaded from the Home page.
Limitations
The Template Builder does not support bidirectional display of text in the user interface.
This section describes how to get started with creating RTF templates using the Template Builder for Word.
It contains the following topics:
When you open Microsoft Word after installing the Template Builder, you see the Oracle BI Publisher menu. Using this you can perform different tasks.
For versions of Microsoft Word prior to 2007, the menu and toolbar are displayed as shown in the following figure:
For Microsoft Word 2007 users, the BI Publisher commands are displayed in the ribbon format, as shown in the following figure:
Use the menu (or toolbar) to perform the following:
Insert data fields into age RTF templates
Insert tables, forms, charts, and pivot tables
Preview the template in multiple outputs
Browse and update the content of form fields
Validate the template
Perform calculations on fields within the template
Connect to the Oracle BI Publisher catalog to retrieve data to build the template
Upload the template to the Oracle BI Publisher server
Extract boilerplate text into an XLIFF translation file and test translations
You can build and upload the template using a direct connection with the BI Publisher server, or you can build and upload the template in disconnected mode.
Connected mode allows you to make changes directly on the BI Publisher server.
To work in connected mode:
The data model defines the XML format that is merged with the RTF template. The Template Builder requires sample data to build the template. You must load sample data to use most of the template builder functionality.
If you are not connected to BI Publisher, then use the procedure in Loading XML Data from a Local File. If you are connected, then use the procedure in Loading Data from the BI Publisher Catalog.
One method of loading data to the Template Builder is to save a sample of the report data to a local directory.
If you do not have access to the report data model, but you can access the report, then you can alternatively save sample data from the report viewer.
To save data from the report viewer:
The Load Data group from the Oracle BI Publisher menu enables you to select and load the saved XML file to the Template Builder.
Sample XML - Enables you to load a sample XML file that contains all fields that you want to insert into the template as a data source. If you are not connected to the BI Publisher server, then use this method to load the data.
XML Schema - Enables you to load an XML Schema file (.xsd) that contains the fields available in the report XML data. The XML schema has the advantage of being complete (a sample XML file might not contain all the fields from the data source). For the preview, the Template Builder can generate dummy sample data for an XML Schema. However, the preview works better if you also upload real sample data.
You can connect directly to the BI Publisher Server to load the BI Publisher report data to the Template Builder to use as sample data for designing layouts.
You can also download an existing template to modify it.
To connect to BI Publisher and load a data source:
This section includes topics that give more information on inserting components to the template.
This dialog enables you to select data elements from the data source and insert them into the template.
In the Insert group select Field to open the Field dialog. The dialog shows the structure of the loaded data source in a tree view, as shown in the following figure:
Select a field that represents a single data field (a leaf node of the tree) and select Insert (you can also insert the field by dragging and dropping it into the document, or by double-clicking the field). A text form field with hidden BI Publisher commands is inserted at the cursor position in the template. You may either select and insert additional data fields or close the dialog by clicking the Close button.
The fields in the Field dialog are explained in these sections.
The Insert Field dialog fields are described in the following sections:
For an XML document with a large and complicated structure, use the find functionality to find a specific field. Enter a partial string of the field name you are searching into the Find field and click Find Next.
The next occurrence of a data element that includes the search expression is selected. Click the Find Next button again to see the next occurrence.
Force LTR Direction check box is only needed if you are using the template in a language that prints the characters from right to left, such as Arabic or Hebrew.
Use this feature to force left-to-right printing for fields such as phone numbers, addresses, postal codes, or bank account numbers.
Calculation feature enables you to perform aggregation functions on data fields, such as sum, average, count, minimum, and maximum.
For example, if you select sum for a data field, then the field shows the sum of all occurring values for this data field, depending on the grouping.
It is important to understand the grouping context (marked by G and E form fields) to know exactly which fields are accumulated. If you insert a data field with an accumulation function into a repeating section (marked by G and E processing instruction form fields), you must select On Grouping to accumulate the data for the occurrences within the group. If you do not want the accumulation to be restricted to the group, you must place the accumulation field outside the group.
The following figure shows a grouping context example:
Also note that the data field must be a valid XSL number for the accumulation functions to work. Formatted numbers cannot be processed by BI Publisher (for example a number using a thousands separator: 10,000,000.00 cannot be processed).
For more information on groups in a template using the Template Builder, see Inserting a Repeating Group and Defining Groups.
The Insert Table Wizard enables you to create standard reports. On the Insert menu select Table Wizard and complete these steps.
Start by selecting the basic report format.
Choose from Table, Form, or Free Form. The following illustration shows examples of each format.
An XML document can include multiple grouped data sets.
For example, a purchase order XML document may contain header level information, lines, shipments and contacts.
In this step, select the data group that contains the data that is required for the table.
For example, in the Balance Letter sample RTF template (found in the Template Builder installed files under Oracle\BI Publisher\BI Publisher Desktop\samples\RTF Templates
), the sample XML file contains three data groups as follows:
ARXCOBLX/G_CUSTOMER
ARXCOBLX/G_CUSTOMER/G_CURRENCY
ARXCOBLX/G_CUSTOMER/G_CURRENCY/G_INVOICES
The Table Wizard presents a list of the available data groups in the XML data file. Select the group that contains the data fields for the table.
The following illustration shows the Table Wizard Step 2: Selecting Table Data.
To build a table to list the invoices contained in the data, select:
ARXCOBLX/G_CUSTOMER/G_CURRENCY/G_INVOICES
as the data set.
The Table Wizard presents the data fields from the selected data set.
The following illustration shows the Table Wizard Step 3: Selecting Data Fields.
Use the shuttle buttons to select the data fields to show in the table. Use the up and down arrows to reorder the fields after selecting them.
This step enables you to regroup the data by a particular field.
This is optional.
For example, if you are building a table of invoices, you may want to group all invoices of a particular type or date to be grouped together in the report.
The following illustration shows the Table Wizard Step 4: Grouping the Table.
There are two options for grouping: Group Left or Group Above. Group Left creates a nested table. The Group By field displays to the left in the outer table. Group Above creates a new table for each new value of the group by field, displaying the value of the group by field as a table title.
Examples follow:
Group Left groups the group by element occurrences together, as shown in the following illustration.
Group Above shows the result as a table with a header, as shown in the following illustration.
When you select an element to group by, BI Publisher sorts the data by the grouping element. If the data is already sorted by the grouping element, then select the Data already sorted check box. This selection improves performance.
Use the Break option to insert either a Page break or Section break after each occurrence of this group.
Note that a Section break can only be created on the top-level group. The subsequent grouping options only display the Page break option.
A page break starts the next group on a new page; a section break starts the next group on a new page, reset page numbering, reset headers and footers, and reset any running calculations for each occurrence of the group.
You can sort the data in the table by up to four different fields.
Select a field and then define the sorting order (ascending or descending), and select the correct data type for the field. For example, if text is selected, "12" comes before "2" (alphanumerical order). If number is selected, "2" comes before "12".
The following illustration shows the Table Wizard Step 6: Sorting the Table.
The Insert Table/Form dialog is the most flexible tool of the template builder. It allows you to perform these tasks.
Create a simple or nested table with a variable number of rows.
Associate a group of data elements, such as a complete invoice or a purchase order line, with a form in the document that is repeated for each occurrence of the data element.
Select and define a layout for all the data fields in the template.
Group or re-group the data.
The Insert Table/Form dialog shows you two tree view panes. The left pane shows the data source structure, while the right pane shows the elements that are copied to the template when you click the Insert button.
First select the data fields to insert in the template and then define how to format them.
Drag an XML element from the left Data Source pane to the right Template pane. If the XML element has children, you see a pop-up menu with the following options:
Drop Single Node
Drop All Nodes
Cancel
Select Drop Single Node if you want to move only the selected node or Drop All Nodes if you want to move the node and all its children.
If you drag an additional data field from the left Data Source pane to the right Template pane, it is either inserted at the same level (Same Level) or below the node (Child) where you release the node. The Insert Position box defines where the node is inserted.
Note:
If you use the left mouse button for drag and drop, then the node and all children are copied. However, if you use the right mouse button for dragging, a dialog is displayed when you release the mouse button. The dialog gives you the option to copy either only the selected node or the selected node and all children.When you select an element in the right Template pane, you see its properties as well as a preview of how the node is rendered.
There are two kinds of nodes:
Data Fields
Data Groups
Data Field nodes (leaf nodes) do not have any child nodes. They represent simple attributes such as the total amount for an invoice or the subtotal for a purchase order line.
Data Group nodes (parent nodes) are nodes that do have child nodes. Typically, they do not represent data attributes, but groups of data - such as an invoice, a purchase order, a purchase order line or a shipment.
If a Data Field node is selected, its properties are shown in the Properties pane. You have these options to describe how the Template Builder should show the field.
Calculation
You can select one of the aggregation functions for the data fields. These functions (besides count) only have an effect when there is more than one of the data fields in the context where you use the function.
Force LTR (Left-to-Right) Direction
This option is only needed if you are using the template in a language that displays characters from right to left, such as Arabic or Hebrew. Use this option to force left-to-right printing for fields such as phone numbers, addresses, postal codes, or bank account numbers.
The order in which the data elements are shown reflects the order of the columns in the table. If you want to reorder the columns, change the Insert Position box from Child to Same Level. Then drag the elements into the correct order.
If a Data Group node is selected, its properties are shown in the Properties pane. You have the following options to describe how the Template Builder should render the group:
Style
To display the data as a horizontal table with a header, select Table. To display the fields below each other with labels in a table, use Form. If you want to insert the fields into a free-form text section that should be repeated for this element, select Free Form.
Grouping
Grouping is an advanced operation that allows you to group the data by a specific element in the data. For example, you might want to group all invoices by customer. You can select a child element of the selected element as a grouping criterion. See Grouping.
Show Grouping Value
This property is shown only if you have selected a node created by the Grouping functionality. By default, the field you have selected to group the data by is displayed in the report. If you do not want the grouping data field displayed, then select No.
Sort By
Select an element by which the data groups are sorted.
Sort Order
If you have selected an element for Sort By you can select if the data should be sorted either ascending or descending.
Sort Data Type
If you have selected an element for Sort By the data is by default sorted as text. That means that 12 is shown after 111. If the data is numeric, select Number as the sort data type.
Break
This property allows you to insert a page break or a section break between every data group. If you select New Page per Element, then a page break is inserted between each element after the first occurrence.
Tip:
To insert a page break before the first occurrence of an element, use Microsoft Word's page break command.
If you select New Section per Element, then a section break is created for each data group. A section break has the following effects: it inserts page break, it resets the page numbers and new data can be displayed in the header and footer. You typically use this option if you want to print multiple documents (for example invoices or purchase orders) to a single PDF file.
Once you have dragged all data fields over and defined the layout, select the Insert button to place the tables and forms at the cursor position in the document.
You can group any Data Group node, by any of its child Data Field Nodes. For example if you have sales data for multiple quarters, you may want to show the sales data organized by quarter. In this case you would group the sales data rows by the quarter element.
Assume the following structure:
Sales Transaction Quarter Customer Amount
To group the child nodes of a node (Sales Transaction), you select one of the child nodes (Quarter) as the grouping property of the parent node (Sales Transaction). The Template Builder makes this node (e.g. quarter) the parent of the other child nodes (Customer and Amount).
The new structure looks like the following:
Sales Transaction Quarter Customer Amount
The grouping criterion (Quarter) now behaves like any other Data Group Node with children. That means that you can define the layout of its children using the Create As Table, Style, Label, Grouping, and Show Grouping Value properties.
There are distinct differences between the types of fields in templates.
The Insert Table/Form Dialog creates two kinds of form fields:
Form fields representing data elements
Form fields with processing instructions for repeating table rows or document sections
Form fields representing data elements are replaced with the data when the template is processed. Form fields indicating repeating sections are shown as for-each and end for-each in the document.
Note:
If you have selected the Abbreviated form field display option, then the for-each and end for-each form fields are displayed as F and E. The section of the document encapsulated by these two elements is repeated, if the associated data element is repeated in the data.Use the Chart dialog to insert a chart into a template.
The following figure shows the Chart dialog.
BI Publisher supports a large variety of chart types. Expand the Type list to select the chart type for this template.
Drag and drop the data value you want to measure to the Values field (for example, SALES).
You can select multiple Value elements (measures).
The Values field changes depending on the Chart Type that you select:
Combination Graph - Enables three fields for the Value selections.
Scatter Graph - Compares pairs of values. Drag and drop the X and Y data elements to compare.
Bubble Graph - Compares sets of three values. Similar to the scatter graph, the third value is displayed as the size of the bubble.
Stock Graph - Drag and drop the elements that represent the Open, High, Low, Close, and Volume values for the stock graph.
Use the Aggregation option in the Properties pane to do functions such as sum, count, and average.
You can choose to aggregate the Values data as a sum, a count, or an average.
Drag and drop the data element for which you want to see the Value charted (for example, Year).
Select Group Data to group the occurrences of the label element before rendering it in the chart. For example, if you are charting Sales by Year, then selecting Group Data accumulates the values for Year, so that only one occurrence of each year is displayed in the chart. If you do not select Group Data, then the value for every occurrence of Year in the data is plotted separately.
If you want to add a series element to the chart, then drag and drop the element to display as a series. Each value is displayed as a new color in the graph.
Select this box if the chart is inside a grouping and you want the chart to display data only for the occurrences of the data elements within the group.
The properties region enables you to change value and label display names, select color, font, and other display options for the chart.
The properties list changes depending on the chart selection.
By default the data is grouped by the Value element and aggregated by sum.
If you deselect the Group Data check box, then each occurrence of the value element is charted and aggregation functions are not available.
Follow these steps to insert a repeating group.
Follow these steps to create a group around an existing block of text or elements in a template.
This section describes the code inserted by the pivot table builder.
When the Template Builder inserts the pivot table, it inserts a BI Publisher command of the following structure:
<?crosstab: ctvarname; "data-element"; "rows"; "columns"; "measures"; "aggregation"?>
Parameter | Description | Example |
---|---|---|
Ctvarname |
Crosstab variable name. This is automatically generated by the Add-in. |
C123 |
data-element |
This is the XML data element that contains the data elements to include in the pivot table. If the pivot table is inside a repeating group, this field must be manually edited to achieve the expected results. See the table following this section. |
"//ROW" |
rows |
This parameter defines the XML elements for row headers. The ordering information is specified within "{" and "}". The first attribute is the sort element. If not specified, the row header element is used as the sort element. Supported attributes are:
You can specify more than one sort element, for example: "emp-full-name {emp-lastname,o=a,t=n}{emp-firstname,o=a,t=n}" sorts employee by last name and first name. Note that the sort element can be any element in the data set, and does not have to be included in the pivot table. In the preceding example, |
In the example, the first row header is "REGION". It is sorted by "REGION", order is ascending, and type is text. The second row header is "DISTRICT". It is sorted by "DISTRICT", order is ascending, and type is text. |
columns |
This parameter defines the XML elements for column headers. The ordering information is specified within "{" and "}". The first attribute is the sort element. If not specified, the column header element is used as the sort element. Supported attributes are:
You can specify more than one sort element, for example: "emp-full-name {emp-lastname,o=a,t=n}{emp-firstname,o=a,t=n}" sorts employee by last name and first name. Note that the sort element can be any element in the data set, and does not have to be included in the pivot table. In the preceding example, |
In the example, the first column header is "ProductsBrand". It is sorted by "ProductsBrand"; the order is ascending, and type is text. The second column header is "PeriodYear". It is sorted by "PeriodYear"; the order is ascending, and type is text. |
measures |
This parameter defines the XML elements used as measures. |
|
aggregation |
This parameter specifies the aggregation function. Currently, the only supported value is "sum". |
|
Example
This example uses the following XML data:
- <ROWSET> - <ROW> <ProductsType>COATINGS</ProductsType> <ProductsBrand>Enterprise</ProductsBrand> <Region>CENTRAL REGION</Region> <District>CHICAGO DISTRICT</District> <PeriodYear>1998</PeriodYear> <Revenue>1555548.0</Revenue> <PrevRevenue>125968</PrevRevenue> <Units>11</Units> </ROW> ... </ROWSET>
The full data set includes four values for ProductsBrand, four values for Region, and two values for PeriodYear to be displayed in the pivot table.
Using the Template Builder for Word and the sample XML file you can create a pivot table as shown in the following illustration.
The generated XDO command for this pivot tables is as follows:
<?crosstab:c4536;"//ROW";"Region{,o=a,t=t},District{,o=a,t=t}";"PeriodYear{,o=a,t=t},ProductsBrand{,o=a,t=t}";"Revenue,PrevRevenue";"sum"?>
Running the command on the given XML data files generates this XML file "cttree.xml". Each XPath in the "cttree.xml" is described in the following table. The information in the table is to help you understand how BI Publisher constructs the pivot table. The generated cttree.xml file is not accessible for viewing or updating.
Element | XPath | Count | Description |
---|---|---|---|
C0 |
/cttree/C0 |
1 |
This contains elements which are related to column. |
C1 |
/cttree/C0/C1 |
4 |
The first level column "ProductsBrand". There are four distinct values. They are shown in the label H element. |
CS |
/cttree/C0/C1/CS |
4 |
The column-span value. It is used to format the pivot table. |
H |
/cttree/C0/C1/H |
4 |
The column header label. There are four distinct values "Enterprise", "Magicolor", "McCloskey" and "Valspar". |
T1 |
/cttree/C0/C1/T1 |
4 |
The sum for measure 1, which is Revenue. |
T2 |
/cttree/C0/C1/T2 |
4 |
The sum for measure 2, which is PrevRevenue. |
C2 |
/cttree/C0/C1/C2 |
8 |
The first level column "PeriodYear", which is the second group-by key. There are two distinct values "2001" and "2002". |
H |
/cttree/C0/C1/C2/H |
8 |
The column header label. There are two distinct values "2001" and "2002". Because it is under C1, the total number of entries is 4 x 2 = 8. |
T1 |
/cttree/C0/C1/C2/T1 |
8 |
The sum for measure 1 "Revenue". |
T2 |
/cttree/C0/C1/C2/T2 |
8 |
The sum for measure 2 "PrevRevenue". |
M0 |
/cttree/M0 |
1 |
This contains elements that are related to measures. |
M1 |
/cttree/M0/M1 |
1 |
This contains summary for measure 1. |
H |
/cttree/M0/M1/H |
1 |
The measure 1 label, which is "Revenue". |
T |
/cttree/M0/M1/T |
1 |
The sum of measure 1 for the entire Xpath from "//ROW". |
M2 |
/cttree/M0/M2 |
1 |
This contains summary for measure 2. |
H |
/cttree/M0/M2/H |
1 |
The measure 2 label, which is "PrevRevenue". |
T |
/cttree/M0/M2/T |
1 |
The sum of measure 2 for the entire Xpath from "//ROW". |
R0 |
/cttree/R0 |
1 |
This contains elements that are related to row. |
R1 |
/cttree/R0/R1 |
4 |
The first level row "Region". There are four distinct values, they are shown in the label H element. |
H |
/cttree/R0/R1/H |
4 |
This is the row header label for "Region". There are four distinct values "CENTRAL REGION", "EASTERN REGION", "SOUTHERN REGION" and "WESTERN REGION". |
RS |
/cttree/R0/R1/RS |
4 |
The row-span value. It is used to format the crosstab table. |
T1 |
/cttree/R0/R1/T1 |
4 |
The sum of measure 1 "Revenue" for each distinct "Region" value. |
T2 |
/cttree/R0/R1/T2 |
4 |
The sum of measure 1 "Revenue" for each distinct "Region" value. |
R1C1 |
/cttree/R0/R1/R1C1 |
16 |
This contains elements from combining R1 and C1. There are 4 distinct values for "Region", and four distinct values for "ProductsBrand". Therefore, the combination is 4 X 4 =16. |
T1 |
/cttree/R0/R1/R1C1/T1 |
16 |
The sum of measure 1 "Revenue" for each combination of "Region" and "ProductsBrand". |
T2 |
/cttree/R0/R1/R1C1/T2 |
16 |
The sum of measure 2 "PrevRevenue" for each combination of "Region" and "ProductsBrand". |
R1C2 |
cttree/R0/R1/R1C1/R1C2 |
32 |
This contains elements from combining R1, C1 and C2. There are 4 distinct values for "Region", and four distinct values for "ProductsBrand", and two distinct values of "PeriodYear". Therefore, the combination is 4 X 4 X 2 = 32. |
T1 |
/cttree/R0/R1/R1C1/R1C2/T1 |
32 |
The sum of measure 1 "Revenue" for each combination of "Region", "ProductsBrand" and "PeriodYear". |
T2 |
/cttree/R0/R1/R1C1/R1C2/T2 |
32 |
The sum of measure 2 "PrevRevenue" for each combination of "Region", "ProductsBrand" and "PeriodYear". |
R2 |
/cttree/R0/R1/R2 |
18 |
This contains elements from combining R1 "Region" and R2 "District". Because the list of values in R2 has dependency on R1, the number of entries is not just a simple multiplication. |
H |
/cttree/R0/R1/R2/H |
18 |
The row header label for R2 "District". |
R1N |
/cttree/R0/R1/R2/R1N |
18 |
The R2 position number within R1. This is used to check if it is the last row, and draw table border accordingly. |
T1 |
/cttree/R0/R1/R2/T1 |
18 |
The sum of measure 1 "Revenue" for each combination "Region" and "District". |
T2 |
/cttree/R0/R1/R2/T2 |
18 |
The sum of measure 2 "PrevRevenue" for each combination of "Region" and "District". |
R2C1 |
/cttree/R0/R1/R2/R2C1 |
72 |
This contains elements from combining R1, R2 and C1. |
T1 |
/cttree/R0/R1/R2/R2C1/T1 |
72 |
The sum of measure 1 "Revenue" for each combination of "Region", "District" and "ProductsBrand". |
T2 |
/cttree/R0/R1/R2/R2C1/T2 |
72 |
The sum of measure 2 "PrevRevenue" for each combination of "Region", "District" and "ProductsBrand". |
R2C2 |
/cttree/R0/R1/R2/R2C1/R2C2 |
144 |
This contains elements from combining R1, R2, C1 and C2, which gives the finest level of details. |
M1 |
/cttree/R0/R1/R2/R2C1/R2C2/M1 |
144 |
The sum of measure 1 "Revenue". |
M2 |
/cttree/R0/R1/R2/R2C1/R2C2/M2 |
144 |
The sum of measure 2 "PrevRevenue". |
When you create a pivot table inside a repeating group you must manually edit the pivot table code so that the elements included in the pivot table respect the grouping context. The edit to the code depends on how you grouped the data.
If your data is flat and you used the Template Builder's Group By feature to group your data, use the Procedure When Using the Template Builder "Group by" Feature. If the data is already grouped, use the Example 5-1.
Procedure When Using the Template Builder "Group by" Feature
After inserting the pivot table, open the BI Publisher Properties dialog to view the <?crosstab...?>
code. In the crosstab
command, update the data-element component to current-group()
.
For example, assume in the preceding example you created a repeating group around the pivot table that is grouped by the <Region>
element.
To edit the pivot table code:
Example 5-1 Procedure When the Data is Already Grouped
If the data input to the Template Builder is already grouped, then you must insert the appropriate XPath for the data-element component to ensure that the pivot table only includes the elements in the current group.
For example, assume the data for this report is structured as follows:
<ROWSET> <REGION> <RegionName>CENTRAL REGION</RegionName> <ProductList> <Product> <ProductsBrand>Enterprise</ProductsBrand> <District>CHICAGO DISTRICT</District> <PeriodYear>2001</PeriodYear> <Revenue>1555548.0</Revenue> <PrevRevenue>125968</PrevRevenue> <Units>11</Units> </Product>
In your template you insert a repeating group based on the <REGION> element. When you insert the pivot table within the repeating group, the code appears as
<?crosstab:c10959;"//Product";"District{,o=a,t=t},ProductsBrand{,o=a,t=t}";"PeriodYear{,o=a,t=t}";"Revenue,PrevRevenue";"sum"?>
In this case, to instruct BI Publisher to use only the elements under the current REGION grouping, edit the data-element to use the relative XPath as follows: .//Product
. The edited code is:
<?crosstab:c10959;".//Product";"District{,o=a,t=t},ProductsBrand{,o=a,t=t}";"PeriodYear{,o=a,t=t}";"Revenue,PrevRevenue";"sum"?>
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.
For example, the data contains sales information. The report contains a table that displays sales by industry. You want this table in the report to display information for industries with sales amounts lower than 100,000. Using the insert conditional region functionality, you can select the region that contains the sales table and insert the condition that the sales element must be less than 100,000.
To edit the conditional region, double-click the inserted form field to launch the dialog for editing; or, right-click the form field and select BI Publisher, then Properties.
Using the Conditional Format feature you can insert simple conditional formats to apply to table rows or cells. The dialog provides several common options that you can select and the Template Builder inserts the code automatically. The Conditional Format dialog supports two conditions per field.
Note:
The Conditional Format dialog cannot be used inside of pivot tables. You must insert the conditional formatting logic directly to the appropriate form fields.
To edit the conditional format, double-click the inserted form field to launch the dialog for editing; or, right-click the form field and select BI Publisher, then Properties.
The Preview menu group enables you to preview the RTF template with sample XML data.
From the Preview group, select the output format. If you have not yet saved the template as an RTF file, then you are prompted to do so.
Note:
If you have not already done so, then you must load sample data to the Template Builder to preview the report. See Accessing Data for Building Templates.You must have Adobe Acrobat Reader version 5.0 or higher installed to preview documents in PDF format.
HTML
Launches the default browser to display the report.
EXCEL
To use this option, you must have Microsoft Excel 2003 or later. If you have Excel 2007, this option generates the document in .xlsx, the default Office Excel 2007 XML-based file format.
If you have Excel 2003 this option generates the document in MHTML and opens the document in Excel.
EXCEL 2000
Generates HTML and launches Microsoft Excel to render it. Embedded images such as charts and logos are not supported in this output type. If you do not have Microsoft Excel 2003 or later, use this option.
RTF
Generates the report in Rich Text Format.
PowerPoint
Requires Microsoft PowerPoint 2003 or 2007.
This section describes additional tools provided with the Template Builder to help you validate and edit the template.
This section includes:
Once you have inserted a data field you can view or edit the field properties in the BI Publisher Properties dialog.
To insert a field, see Inserting a Field.
Double-click the field
Right-click the field, from the menu select BI Publisher, then Properties
The following figure shows the BI Publisher Properties dialog: note the Properties tab, the Advanced tab, and the Word Properties button. Some fields might display only the Advanced tab.
BI Publisher Properties tab defines the different fields and options available in the General, Formatting, and Data Aggregation panes of the tab.
You can set the following properties for a data field:
Data Field - Select the data field from the list of available fields from the loaded data source.
Text to Display - Enter the display text for the form field in the template. This text is replaced at runtime by the value in the data.
Type - Select the type of data. Options are Regular Text, Number, Date, Current Date, and Current Time. The selection in this field determines the format options.
Format - For any data type except Regular Text, you can select from several number or date display formatting masks or enter your own.
Force LTR - (Force Left-to-Right) Use this check box when you are publishing the template in a language that prints the characters from right to left, such as Arabic or Hebrew. Use this option to force left-to-right printing for fields such as phone numbers, addresses, postal codes, or bank account numbers.
Function - This feature enables you to perform aggregation functions (Sum, Average, Count, Minimum, Maximum) on data fields. For example, if you select sum for a data field, then the field shows the sum of all occurring values for this data field depending on the scope (see below). See also Inserting a Field for information on aggregation functions.
Scope (informational only) - This field has two possible values:
Group Item - Indicates that the data field is inside a group. If you choose to perform a function on the field, then only the occurrences of the field within the current group are included in the aggregation.
Normal - Indicates that the field is not inside a group. Aggregation functions are performed on all occurrences of the field in the data.
The Advanced tab displays the underlying code.
If the code pattern within the form field is not recognized (for example, because you added commands manually to the field), then the BI Publisher Properties dialog displays this tab only.
Use this tab to edit or add code to the form field manually. Click OK to update the template.
The Template Builder provides a validation tool to check the template for incorrect use of BI Publisher commands and unsupported elements in the RTF file.
To validate the template:
If there are no validation errors, then a "No Error found" message is returned. If an error is found, then an error message is displayed. You can use the Field Browser to help locate the error.
The Field Browser dialog provides a fast way to review and update the BI Publisher instructions hidden in the Microsoft Word form fields.
This dialog is particularly useful to understand and modify existing templates.
On the Tools group, click Field Browser.
The following illustration shows the Field Browser dialog.
The Field Browser dialog shows a table with the display text of the form field in the Text column and the underlying code instructions in the second Code column. When you select a specific row in the dialog, the matching form field is selected in the Microsoft Word document.
If you select some part of the text before opening the Field Browser, then the dialog shows only the fields in the selection. If no text is selected, then the field browser shows all fields in the document.
The options in the Field Browser are described in the following table.
Option | Description |
---|---|
Edit |
You can update processing instructions directly from the Field Browser dialog. Select a field in the Text table. The Edit box shows the processing instructions for the field. To change the instructions for the field modify the text in the Edit field and click Update. |
Refresh |
The Field Browser dialog is not aware of any form fields that you have added or modified while the dialog is open. Click Refresh to show any changes to the document since the Field Browser dialog has been opened. |
Show All |
If you opened the browser with a part of the document selected, then you see only the form fields in the selected area. Click Show All to see all the form fields in the document. |
Close |
Click Close to close the field property browser. The only button does not automatically update any changes in the edit field, therefore ensure that you select Update if you want to save edits. |
The 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 assistive technologies to view the report.
To check for the presence of accessibility features: On the BI Publisher tab, in the Tools group, click Check Accessibility. The tool generates a report that indicates areas of a template that do not include the following accessibility features:
document title
alternative text for images
table summary for data tables
column header for data tables
row header for data tables
In some cases the accessibility checker cannot determine if the accessibility feature is present and generates a warning. The report designer can then verify that the accessibility features are present.
For information on how to add these features to the template, see Designing Accessible Reports.
If you used the Open Template dialog to connect to BI Publisher, and load the data to the Template Builder, or if you downloaded an existing template from the BI Publisher catalog, then you can upload the new or updated layout back to the report definition on the server.
See Working in Connected Mode.
If you downloaded an existing template and want to upload the modifications to the template, then select Upload Template from the Oracle BI Publisher menu.
If this is a new template for the report definition, then use the Upload Template As option to upload the layout to the report definition on the server. Also use this option to upload modifications to an existing template under a different name.
Translation is simplified by using Template Builder tools.
The Template Builder provides tools to help you create and test translations for templates.
The section describes options for adding translated templates to a report.
There are two options for adding translated templates to a BI Publisher report definition:
Create a separate RTF template that is translated (a localized template)
Generate an XLIFF file from the original template (at runtime the original template is applied for the layout and the XLIFF file is applied for the translation)
Use the first option if the translated template requires a different layout from the original template.
If you only require translation of the text strings of the template layout, use the XLIFF option.
For detailed information, see Translation Support Overview and Concepts.
To use the Template Builder translation tools to create templates for translations, see the following topics in this section:
Extracting Text to an XLIFF File for Translation
Previewing a Translation
Localizing a Template
For a demo on BI Publisher's localization capabilities, see the LocalizationDemo.exe demo provided with the Template Builder installation (located in the BI Publisher\BI Publisher Desktop\demos folder where you installed BI Publisher Desktop).
This menu item allows you to create a standard XLIFF translation file that contains the boilerplate text from the template. XLIFF is a standard file format that is understood by many translation software packages. Since an XLIFF is an XML file, you can translate the text in a regular text editor.
A translatable string is any text in the template that is intended for display in the published report, such as table headers and field labels. Text supplied at runtime from the data is not translatable, nor is any text that you supply in the Microsoft Word form fields.
You can preview the translation of a template as a PDF file.
To preview the template with the translated XLIFF file applied:
The Template Builder merges the sample data, the translation file, and the RTF template to generate a PDF for preview.
Localizing a template means that you are creating a template to be used for a specific language.
Because BI Publisher enables you to extract the boilerplate text strings from a template into an XLIFF file that can be translated and then applied at runtime, if the reports for additional languages only require the translation of these text strings, then you only need to supply translated XLIFF files to accompany the base template.
However, you would localize a template when the requirements for the report in the specific language go beyond the simple translation of the text in the layout.
To save a template as a localized template:
Use the Options dialog to specify template settings.
Access the Options dialog as follows: In the Options group, click Options.
The Options dialog contains four tabs: UI, Preview, Build, and Connection, as described in the following sections.
Use the Options dialog: UI tab to set options that influence the look and feel of the Template Builder.
The following illustration shows the Options dialog: UI tab.
The tree view that shows the data source can show either the correct XML tag names of the data source or they can show a slightly modified version that is easier to read. Select the option Element Names for Report XML to show the modified labels. These labels contain no <> characters, use "Title case" and use spaces (" ") instead of underscores ("_").
The Options dialog: Preview tab allows you to specify options that influence the Preview functionality of the Template Builder.
The following illustration shows the Options dialog: Preview tab.
The following table describes the options available from the Preview tab.
Option | Description |
---|---|
Style Template |
If you have a BI Publisher Style Template available locally, then you can specify it here. A style template is an RTF template that contains style information that can be applied to RTF layouts, similar to a style sheet. 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. For more information, Creating and Implementing Style Templates. |
Locale |
You can choose the language and territory used for previewing the template. While this change does 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. |
Java Home |
The Preview (and export functionality) requires Java code. You can change the path to the JAVA HOME directory. If this option is not specified, the Template Builder assumes that the Java virtual machine (java.exe) is accessible in the PATH specified in the environment variables of Windows. |
Java Option |
Specify the memory to reserve for the Template Builder to process the template. The default value is -Xmx256M. |
Use the Options dialog: Build tab to specify options that influence how the Template Builder generates tables and forms.
The following illustration shows the Options dialog: Build tab.
The following table describes the options available from the Build tab.
Option | Description |
---|---|
For-each form field |
Select how the Template Builder creates the form fields for processing instructions in the Insert Table/Form dialog. 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. Note that the descriptive option does not apply to fields within table cells. The Abbreviated option (for example: F) provides a one letter abbreviation for each instruction. Select the Hidden box to generate the processing instruction form fields using Microsoft Word's hidden font effect. Hidden text is hidden in the Print Preview and you may display or hide the hidden text by changing the Hidden Text setting in the Display group of the Microsoft Word Options. |
Form Field Size |
Large - inserts the BI Publisher code to a document variable. The document variable field can accommodate approximately 48 kilobytes of code line. It is important to note that this setting affects only fields that are created or edited while this option is set. The form fields created with the Large setting cannot be understood by Oracle BI Publisher 10g. If the template is intended for use with the 10g version of BI Publisher, use the Backward Compatibility setting. Backward Compatible - in previous versions of the Template Builder the BI Publisher code was inserted to the Microsoft Word Form Field Help Text box. This limited the length of code that could be inserted for a single form field. By default, the Large option is used because it can accommodate much larger code strings. However, the Large option is not compatible with Oracle BI Publisher 10g. |
Table Header Color |
When you insert a table using the Table Wizard or the Insert Table/Form dialog the Template Builder applies the Table Header Color specified here to the table header background. Customize the default color for the 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. By default, BI Publisher is compatible with XSLT 1.0. If you want to use XSLT and XPath 2.0 features in the template, then enable this option. This configuration is performed at the template level. The template-level setting overrides the server setting. |
The Template Builder can be used with a BI Publisher configuration file.
The configuration file must be named xdoconfig.xml and must be stored in the config directory (example path: C:\Program Files\Oracle\BI Publisher Desktop\Template Builder for Word\config
) under the BI Publisher directory.
Alternatively, you can use the file name xdo.cfg, which is used by the BI Publisher server. The configuration file allows you to:
Define additional fonts such as Windings to test the templates
Use security settings for PDF files
When you install the Template Builder the next time you open Microsoft Word, you see the Oracle BI Publisher menu.
Note:
If you are using Microsoft Word 2007, then you might have to modify the Add-In settings. Click the Office button, click Word options, then click Add-Ins.
The Online group of commands enable you to initiate interaction with the BI Publisher application.
For more information about working with the online commands, see Working in Connected Mode.
The following figure shows the Online group of commands.
The following table describes the commands available for the Online group.
Command | Description |
---|---|
Log on |
Enables you to log in to BI Publisher. Enter your user name and password. Select or enter the URL for the BI Publisher Report Server (see your Administrator if you do not know the URL). When you log on, the Open Template dialog is displayed. You must log in directly to the BI Publisher server. For example:http://www.example.com:7001/xmlpserver . |
Open |
After you log on, this command becomes available to enable you to open a report in the BI Publisher catalog. |
Upload Template |
If you used the Open Template dialog to download a template from the BI Publisher catalog, use this option to upload the updated layout back to the report definition in the catalog. |
Upload Template As |
If you used the Open Template dialog to download a template or to open a report from the catalog, use this option to upload the layout to the report definition in the catalog. Also use this option to upload modifications to an existing template under a different name. |
Save XML Data |
If you are working in connected mode, then use this command to save the data to a local directory if you also need access to the data in disconnected mode. |
The Load Data group of commands enables you to load a saved sample data file or sample schema to the Template Builder.
You must load data to use most of the Template Builder functionality. See Accessing Data for Building Templates for more options for loading data to the Template Builder.
The following figure shows the Load Data group of commands.
The Load Data Group options table below describes the commands available for the Load Data group.
Command | Description |
---|---|
Sample XML |
This command enables you to load a previously saved sample XML file from the report data source. If you are not connected to the BI Publisher server, use this method to load the data. |
XML Schema |
This command enables you to load an XML Schema file (.xsd) that contains the fields available in the report XML data. The XML schema has the advantage of being complete (a sample xml file may not contain all the fields from the data source). For the preview, the Template Builder can generate dummy sample data for an XML Schema. However, the preview works better if you also upload real sample data. |
Use the Insert group of commands to insert the layout components to the template.
To insert components, see Inserting Components to the Template.
The following figure shows the Insert group of commands.
Command | Description |
---|---|
Table Wizard |
This function provides a wizard that guides you through the creation of tables used in typical reports. |
Pivot Table |
The Pivot Table function enables you to drag and drop the data elements to a pivot table structure. |
Chart |
BI Publisher doesn't recognize native Microsoft Word charts. The Insert Chart function allows you to insert a chart that's understood by Oracle BI Publisher. |
Field |
This function allows you to select fields from the data source and insert them into the template. As a beginner, you should use Insert Fields only for data fields that are unique - none repeating - in the document. See Inserting a Table Using the Table Wizard for additional information on how to insert repetitive fields. |
Table/Form |
Use this function to insert data fields to be organized as a simple or nested table or as a form that's repeated with different data. You may even organize all the data fields for the whole document before inserting them. |
Repeating Group |
Enables you to select or define a group of elements that you want repeated for each occurrence of an element in the data. |
Conditional Format |
Enables you to define simple conditional formats to apply to table rows or cells. |
Conditional Region |
Enables you to insert a conditional statement around a region of the template. |
All Fields |
This function inserts all fields found in the XML data into the document. It also inserts processing instructions into the document that repeats a section - such as a table row - when the associated XML element is repeated. XML documents often contain a large number of fields in a deeply nested hierarchy. For example, an Oracle Purchasing purchase order contains purchase order lines, which contain shipments, which contain distributions. The purchase order line alone contains more than 150 data fields. In these cases, you should use the Insert Table/Form function to have more control over which fields are inserted. |
The Preview group of commands enables you to preview the RTF template with the sample XML data. The preview menu offers PDF, HTML, RTF, PowerPoint, and Excel as output formats.
When you select any of these output formats, the Template Builder merges the data into the template and creates the output document.
The following figure shows the Preview group of commands.
Note:
You must have Adobe Acrobat Reader version 5.0 or higher installed to preview documents in PDF format.
The section describes the commands available for a the Tools group.
For more information about using the commands in the Tools group refer to Template Editing Tools and Using the Template Builder Translation Tools.
The following figure shows the Tools group of commands.
The table below describes the commands available for the Tools group.
Command | Description |
---|---|
Field Browser |
The field browser is a tool for advanced users who must change the BI Publisher commands that are hidden in the form fields. It shows the commands behind each form field and allows you to change 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. |
Translation |
Includes the following subcommands:
|
Export |
Includes the following functions:
|