You are on page 1of 26

Practices for Lesson 7:

Working with Style Templates


and Sub Templates
Chapter 7

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 1
Practices for Lesson 7: Overview

Goal
To explore and create Style and Sub Templates that allow you to apply custom formatting to
RTF report templates and report layouts

Practices Overview
You create both Style and Sub Templates in MS Word, upload, apply them to an RTF report
template and report layout.

Caution: Creating styles and templates in MS Word is extremely error prone. Follow the steps
in each practice very carefully.

Time
35 – 45 minutes

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 2
Practice 7-1: Creating a Formatted RTF Template

Overview
In this practice, you create an RTF template and define formatting styles. In order to visualize
the relationship between an existing report and a new Style Template, you will create an
unformatted report template first and upload this to the BI Publisher Server. You will then create
a new Style Template that you will upload and apply to the unformatted report.

Tasks
1. Add the Table Styles icon to your MS Word Quick toolbar. Open MS Word.

2. Click the Office button ( ) and click Word Options. The Word Options dialog box
appears.
3. Select Customize and from the “Choose commands from” drop-down list, select All
Commands.
4. Scroll down and locate Table Styles in the list of commands. Select the first Table Styles
command in the list ( ).

5. Click Add and then click OK.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 3
6. The Tables Styles icon appears in the Quick toolbar.

7. Download the Simple.rtf. Using Firefox, click the Catalog link in BI Publisher Enterprise
Edition, navigate to “Salary Report – No Parameters” located in \Shared
Folders\Sample Lite > Published Reporting > Reports, and click the Edit
link.
8. In the Report Editor, click the Edit link for the Simple layout.

9. In the “Opening Simple.rtf” dialog box, click OK.

10. Click Cancel in the Save As dialog box.


11. Highlight Salary Report and press Delete.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 4
12. Select the table.

13. Click the Table Styles icon ( ) and click Clear.

This removes all formatting from the table.


14. With the table still selected, click the Table Styles icon ( ) and click New Table Style.
The “Create New Style from Formatting” dialog box appears.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 5
15. Select the radio button for “New documents based on this template.”
16. Name the new style My Table and click OK.

17. Ensure that the new style was applied. Select the table and click the Table Styles icon.
Select your table from the Custom section.

18. Click Save As, navigate to your Learn folder, and name the file My_Simple.rtf.
19. Upload this RTF file to the BI Publisher Server as a new report. The Report Editor should
still be open in your browser for “Salary Report – No Parameters.” Click Add New Layout.
20. Click Upload.
21. In the Upload Template File dialog box, do the following: Enter My Formatted Salary
Report in the Layout Name text box. For the Template File field, browse to locate
My_Simple.rtf. Select RTF Template as the Type, and English (United States) as the

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 6
Locale.

22. Click Upload.


23. Click Save and then click View Report.
24. Click the My Formatted Salary Report tab to ensure that your report does not have any
formatting.

25. In MS Word, close all documents and then open a new blank document.
26. On the MS Word ribbon Home tab, click the Styles icon within the Styles grouping to open
the Styles pane.

The Styles pane appears to the right of your RTF layout.


Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 7
27. On the Insert tab of the ribbon, click Header > Blank.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 8
28. Enter My Salary Report in the “Type text” area of the header and change the text to
Arial Black, 12 pt, and italic.

29. Insert a blank line just above the My Salary Report text. Insert the Oracle logo
(O_signature_clr.gif) located in “My Templates and Files.” Select the Oracle image
and the text, and then click the center icon ( ). The header should look like this:

30. Right-click anywhere within the header and select Styles > “Save Selection as a New
Quick Style” from the shortcut menu.

31. In the Styles dialog box, enter My Header as the name and click OK.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 9
The new style appears in the Style pane.

32. Scroll down to locate the footer area. Double-click in the footer area. Enter Private and
Confidential in the footer, and change the text to Arial Black and 12 pt. Center the
text.

The footer should look like this:

33. Once again, right-click and save this style as My Footer.


34. Now you create a stylized table that has the same name as the style in the report template,
namely “My Table.” You give the table style the same name in the style template and report
template, enabling you to have different templates at every location that uses this report,

but with their own color scheme, and so on. Click Manager Styles ( ) in the Styles
pane.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 10
35. Select Alphabetical from the “Sort order” drop-down list. Locate My Table in the “Select a
style to edit” pane and click Modify.

36. In the Modify Style dialog box, change “Style based on:” to Light Shading – Accent 3.
Change the font color to blue. Change the font to Arial and the font size to 12. The dialog

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 11
box should look similar to this:

37. Click OK and then click OK once more. Navigate to the Learn folder on your desktop and
save the RTF file as My Formatted Salary Report.rtf.
38. Double-click in the body of the document to set the focus within the document and not the
header or footer. Insert a 2X2 table and then select the table.

39. You need to apply your style to the table. Click the Table Styles icon and select “My Table”
from the Custom grouping.

Your RTF file should like similar to this:

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 12
40. Save the RTF file once more.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 13
Practice 7-2: Creating a BI Publisher Style Template

Overview
In this practice, you create a BI Publisher Style Template.

Assumptions
To perform the tasks in this practice, you use the My Formatted Salary Report.rtf file
created in the previous practice.

Tasks
1. Log in to BI Publisher Enterprise Edition. From either the Catalog page or the global
header, select New > Style Template.

The Style Template dialog box appears. In the Templates area, click Upload ( ).

2. In the Upload Template File dialog box, click Browse and navigate to My Formatted
Salary Report.rtf. Accept rtf as the default Template Type, and select English

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 14
(United States) as the Locale.

3. Click OK. Your template appears in the Templates section.

4. Click Save ( ). Navigate to \Shared Folders\Sample Lite\Published


Reporting\Style Templates and save your template as My Formatted Salary
Template. The BI Publisher Server can now recognize your template.
5. Click Catalog and navigate to “Salary Report – No Parameters” located in \Shared
Folders\Sample Lite\Published Reporting\Reports.

6. Click Edit.
7. In the Report Editor, click “View a list.”

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 15
8. In the Layout pane, click the Browse icon ( ); navigate to \Shared Folders\Sample
Lite\Publisher Reporting\Style Templates, select My Formatted Salary
Template, and click Open.
9. Your Style Template appears in the Apply Style Template text box.

Locate the My Formatted Salary Report.rtf file, ensure that this is the Default
Layout (select the Default Layout check box), and select the Apply Style Template check
box.

10. Click Save Report ( ).


11. Click View Report.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 16
Your Style Template is applied to the report layout.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 17
Practice 7-3: Previewing Output by Using a Style Template

Overview
In this practice, you apply your newly created Style Template to an existing RTF file that you
previously created, and then you preview the output in Template Builder.

Assumptions
To perform the tasks in this practice, you use the Manager Financials Report.rtf file
created in the “Designing an RTF Template for a BI Publisher Report in Connected Mode”
practice.

Tasks
1. In MS Word, open Manager Financials Report.rtf located in the Learn folder on
your desktop.
2. Load the sample data. Click Sample XML from the Load Data grouping and select Salary
Report - No Parameters.xml located in the “My Templates and Files” folder on your
desktop.
3. Click Options from the Options grouping.

4. The Options dialog box appears. Click the Preview tab and click Browse.
5. From the “Please select XML data” dialog box, navigate to your new Style Template, My
Formatted Salary Report.rtf, and click Open. The Options dialog box reappears.

6. Click OK.
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 18
7. In the Preview grouping, click PDF. The formatted report appears.

8. Close the PDF.


9. Close all documents.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 19
Practice 7-4: Creating an RTF Sub Template

Overview
In this practice, you create a Sub Template, upload it to the BI Publisher Server, and associate it
with reports.

Caution: Entering xsl code into a Sub Template can be extremely prone to error. You should
copy and paste the syntax into the document to preclude any issues.

Tasks
1. Open a blank document in MS Word.
2. Enter <?template:Header?> in the body of the document.
Note: Header is the name of the Sub Template. Consider copying and pasting this code
into the template.
3. Press Enter.
4. Insert the Oracle logo (O_signature_clr.gif) located in “My Templates and Files.”
5. Press Enter.
6. Enter My Employee Salary Report as the title and center the text. Format the title as
you deem appropriate.
7. Press Enter.
8. Enter <?end template?> to close the Header template instructions.
Note: Consider copying and pasting this code into the template.
9. Save the Sub Template as headerfooter.rtf in your Learn folder.
The RTF file should look similar to this:

10. Enter <?template:Footer?> in the body of the document.


Note: Footer is the name of the Sub Template. Consider copying and pasting this code
into the template.
11. Press Enter.
12. Enter ****Confidential**** and center the text. Format the footer as you deem
appropriate.
13. Press Enter.
14. Insert a page number and right-justify the page number.
15. Press Enter.
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 20
16. Enter <?end template?> to close the Footer template instructions.
Note: Consider copying and pasting this code into the template.
17. Save the Sub Template again.
The RTF file should look similar to this:

18. Next, upload the Sub Template to BI Publisher Server. You use the same technique to
upload the Sub Template that you used to upload the Style Template. If you are not logged
in to BI Publisher Enterprise, do so now. Click New > Sub Template.

19. Click Upload ( ).


20. Navigate to locate and select your Sub Template, headerfooter.rtf.
21. Accept the default Template Type, and select English (United States) as the Locale.

22. Click OK.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 21
23. Click Save. Navigate to \Shared Folders\Sample Lite\Published
Reporting\Style Templates and save your file as Header Footer Sub Template to
the BI Publisher Server.
24. Next, you must create the main RTF that calls your Sub Template file. Begin by opening the
Manager Financials Report.rtf file. Load the Sample XML data, Salary Report
- No Parameters.xml, from the “My Templates and Files” folder.
25. Recall from your lesson that you must have at least two entries to call your Sub Template.
These entries are the import and call statements.

Just above the RTV code field, press Enter twice. On the first blank line enter
<?import:xdoxsl:///Sample Lite/Published Reporting/Style
Templates/Header Footer Sub Template.xsb?>. Header Footer Sub Template is
the name that you gave the Sub Template on the BI Publisher Server.
Note: Copy and paste this code into the template.

26. Insert a blank header (Insert > Header > Blank) and enter the following code:
<?call:Header?>.
Note: Copy and paste this code into the template.

27. Scroll down to the footer area. In the footer area, enter the following code:
<?call:Footer?>.
Note: Copy and paste this code into the template.
28. Close the header and footer.
29. On the BI Publisher ribbon, click Options from the Options grouping. Click the Preview tab
and remove the prior Style Template and click OK.
30. Save the RTF file as My Financials For Sub Template.rtf in your Learn folder on
your hard drive.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 22
31. To test this locally, you will temporarily need to comment out the import statement. In the
beginning of the import statement inside the bracket, add an exclamation point (!) and
two dashes (--). At the end of the statement following the question mark (?), add two
dashes (--). The commented out code should look like this:
<!--?import:xdoxsl:///Sample Lite/Published Reporting/Style
Templates/Header Footer Sub Template.xsb?-->
32. Directly below your commented out code, provide a path to your template. Enter the
following code:
<?import:file:///D:\Learn\headerfooter.rtf?>
Note: Copy and paste this code into the template.
33. Save this as a new RTF file named My Local Sub Template.rtf.
34. From the Preview grouping, click PDF. (If prompted to reload your data, load the Sample
XML data, Salary Report - No Parameters.xml, from the “My Templates and Files”
folder.) Your PDF appears.

Note: If the PDF does not display properly, the latter portion of this practice will not work.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 23
35. Now you must upload the newly created “main” RTF file to the BI Publisher Server. In BI
Publisher, click New > Report.

36. Select Salary Report Data Model and click Open.

37. Click Upload in the Report Editor. The Upload Template File dialog box appears.
38. Enter My Main RTF in the Name text box.
39. Browse to locate the main template file, My Financials For Sub Template.rtf.
40. Select RTF Template and the Type and English (United States) as the Locale.
41. Click Upload. The template appears in the Report Editor.
42. Save the report as My Financials ST Rpt in \Shared Folders\Sample
Lite\Publisher Reporting\Reports.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 24
43. Click View Report.

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 25
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Working with Style Templates and Sub Templates
Chapter 7 - Page 26

You might also like