Sie sind auf Seite 1von 12

Creating Web

Layout Templates

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

You can use templates to define common characteristics and objects that you want to apply to
multiple reports. For example, you can define a template that includes the company logo and
sets fonts and colors for selected areas of a report.
To create an Oracle Reports Web Layout template:
1. Create a template file (.tdf file).
2. Create an HTML file that describes the layout.
3. Update the Web Template description file (rwTemplates.xml).
4. Test the new template.
5. Deploy the template in Oracle Reports and Oracle Application Server.
6. Add the template to the template library.

Oracle
Reports
Developer
10g: Build
Reports
C-2
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

Creating Web Layout Templates


This appendix explains how to create a Web layout template for Oracle Reports Builder.

Creating a Web Layout Template


To create a Web layout template in Oracle Reports, you need three files:
1. A paper layout template (.tdf file) that is used to register the template in reports and
to make the relationship between the HTML and the CSS file in the
rwTemplates.xml file. It can also be used as a paper template.
2. A Web layout template (.html file) that is used to create the layout of the template
(default header and footer, position of the data area)

TDF file

HTML CSS
file

HTML file

Oracle
Reports
Developer
10g: Build
Reports
C-3
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

3. A Cascading Style Sheet (CSS) file that is used to define the HTML font of the different
parts of a report.

First, create a Reports template file:


1. In Oracle Reports Builder, choose File > New > Template.
2. In the Object Navigator, under Templates, your new template name is displayed.
3. Specify a name for your template in the Property Inspector, for example MyCompany.
Note: This name is used by Oracle Reports to create the relationship between the HTML
and CSS files.
4. Save the file as MYCOMPANY.tdf in the $ORACLE_HOME/reports/templates/
directory.
You have now created a template. You can edit this template for paper reports by using the
Report Wizard.

Oracle
Reports
Developer
10g: Build
Reports
C-4
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

Creating a Web Layout Template


Step 1: Create a template file (.tdf)

Creating a Web Layout Template


Step 2: Create an HTML file that describes the layout

2. Put all your generic HTML below the following HTML tags:

3. The <rw:style> tag is used to create the link between the template and the CSS that we
created and references into the rwTemplates.xml file:

4. Put all your generic HTML, such as the company logo in the <BODY> tag:

5. Specify the <rw:dataArea> tag, where the Wizard will insert the report block:

Oracle
Reports
Developer
10g: Build
Reports
C-5
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

In an HTML editor, such as Macromedia Dreamweaver, create an HTML page that will define
the areas of your Web layout template.
1. Add the JSP header and taglib, then add the rw:report tag to reference the report
environment:

Creating a Web Layout Template


Step 2: Create an HTML file that describes the layout (continued)
6. Specify all your generic HTML, such as copyright and contact information before the
</BODY> tag

8. Save this document in the $ORACLE_HOME/reports/templates/ directory.

Oracle
Reports
Developer
10g: Build
Reports
C-6
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

7. Close the report reference tag

Oracle University and EGABI SOLUTIONS use only

Creating a Web Layout Template


Step 3: Update the Web layout template description file
The Web layout template description file rwTemplates.xml is located under
$ORACLE_HOME/reports/templates. This file references Oracle Reports templates with
their associated styles.

Oracle
Reports
Developer
10g: Build
Reports
C-7
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Attribute
id

cssFile
classSet
htmlFile

Value
references the name of the module in the Reports template file, for
example, mycompany.tdf. This is not the name of the file, but
the name that you see in the Object Navigator.
references the name of the CSS file that Report Wizard will place in
the <LINK> tag.
references the classSet id into the current XML file. The classSet
makes the relationship between each field type and the CSS Class.
references the file name of the HTML template, for example
myCompany.html.

Oracle
Reports
Developer
10g: Build
Reports
C-8
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

Creating a Web Layout Template


Step 3: Update the Web layout template description file (continued)
1. In the rwTemplates.xml file, add a new <webTemplate> tag entry file to register your
new template.
You add the <webTemplate> tag between the <webTemplates> </webTemplates> tags.
This tag associates the paper layout template, Web layout template and CSS files. The
code displays a sample <webTemplate> tag for the MyCompany template.

Creating a Web Layout Template


Step 3: Update the Web Layout Template Description File (continued)

Name

Value

TableStyle
ColumnHeader
RowHeader

specifies the class name of the <table> tag


specifies the class name of the <th> tag used for the column header
specifies the class name of the <th> tag used at the row header in
matrix reports

CellText

specifies the class name of the <td> tag used for alphanumeric data

CellNumber

specifies the class name of the <td> tag used for numeric data.

CellDate

specifies the class name of the <td> tag used for date data

TotalText

specifies the class name of the <th> tag used for the summary empty
cells
specifies the class name of the <td> tag used for the summary non
empty cells
specifies the class name of the <th> and <caption> tags used for the
group above section

TotalNumber
GroupAboveHeader

3. After adding the <webTemplate> and <classSet> entries, save the rwTemplates.xml
file and restart Reports Builder.

Oracle
Reports
Developer
10g: Build
Reports
C-9
THESE eKIT MATERIALS ARE
FOR YOUR
USE IN
THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

2. If you have a specific CSS file with new class names, you need to add a new classSet
entry in the rwTemplates.xml file. The classSet tag contains all the class name (css)
for each field type. You add the <classSet> tag between the <classSets> </classSets> tags.

Creating a Web Layout Template


Step 4: Test the new Web layout template

2. When you click Finish, you see the new report with your template code. The Report
Wizard replaces the empty <rw:style> and <rw:dataArea > tags with the generated code.

Oracle
Reports
10g: Build
Reports
C-10
THESE eKIT MATERIALS ARE
FOR YOUR
USE Developer
IN THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

1. Create a new report using the Report Wizard, and choose the TDF file you created, for
example, MyCompany.tdf template.

Location
$ORACLE_HOME/reports/docroot/

Description
Default root directory of Oracle
Reports Builder

$ORACLE_HOME/reports/docroot/images

Default image directory of Oracle


Reports Builder
Default CSS directory of Oracle
Reports Builder

$ORACLE_HOME/reports/docroot/css

While deploying a Web report on the Oracle Application Server, you need to make sure that all
the associated elements such as images and CSS files are in the correct location on the server.

Oracle
Reports
10g: Build
Reports
C-11
THESE eKIT MATERIALS ARE
FOR YOUR
USE Developer
IN THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Oracle University and EGABI SOLUTIONS use only

Creating a Web Layout Template


Step 5: Deploying the new Web layout template
You should configure Reports Builder to make sure that all associated elements such as images
and CSS files are in the correct place on the file system

Oracle University and EGABI SOLUTIONS use only

Creating a Web Layout Template


Step 6: Add the Web Layout Template to the Oracle Reports Template Library
If you want your new template to always display in the Predefined Templates list on the
Template page of the Report Wizard, you can add it Oracle Reports Template Library.
You can register your template file as a predefined template by inserting an entry in the
Oracle Reports preferences file and storing the template and (optional) image in the correct
template directory.
Note: This is an optional step.

Oracle
Reports
10g: Build
Reports
C-12
THESE eKIT MATERIALS ARE
FOR YOUR
USE Developer
IN THIS CLASSROOM
ONLY.
COPYING
eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED

Das könnte Ihnen auch gefallen