Skip Headers

Oracle Reports Building Reports
10g (9.0.4)

Part Number B10602-01
Go To Documentation Library
Home
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

18
Building a Report with Graphics, Text, and Color

Figure 18-1 Graphics, text, and color report output

Text description of orbrgraphics_fin.gif follows.

Text description of the illustration orbrgraphics_fin.gif

Reports Builder enables you to modify the look of your report in multiple ways. In this example, you will build a report and enhance it by adding an image to the margin, a title, and a border. You will also change the look of the report by applying different fonts and text styles.

Concepts

This report shows you how to enhance your reports with graphics by:

For more information on enhancing the appearance of your reports, refer to the Reports Builder online help.

Reports Builder enables to you to manipulate the appearance of your report on the fly. If you intend to reuse the look and feel of your report, you can always create a template and add it to your template library. You can find out more information about using templates in Getting Started with Oracle Reports (http://otn.oracle.com/products/reports/).

Data Relationships
Layout

Example Scenario

In this example, you'll create one query that selects all the columns for this report. You'll also assign a column to a new break group.

To see a sample report with graphics and highlighted text, open the examples folder named graphics, then open the Oracle Reports example named graphics.rdf. For details on how to open it, see "Accessing the example reports" in the Preface.

Table 18-1 Features demonstrated in this example
Feature Location

Use the Report Wizard to create a simple report definition.

Section 18.2, "Create a simple report definition"

Modify the appearance of your report in the Paper Layout view.

Section 18.3, "Modify the report in the Paper Layout view"

Run your report to paper.

Section 18.3.1, "Adding a border around the report"

Use the Font dialog box to change the font of your text.

Section 18.3.2, "Change the font size and style"

Use the tool palette to create bullets in your report.

Section 18.3.3, "Add bullets your report"

Use the Line tool to create a horizontal separator between records.

Section 18.3.4, "Display a line between each record"

Use the Fill Color and other layout tools to add a title to your report.

Section 18.3.5, "Add a title to your report"

18.1 Prequisites for this example

To build the example in this chapter, you must have access to the sample schema provided with the Oracle9i database. If you don't know if you have access to this sample schema, contact your database administrator. You should have access to the "Human Resources" portion of the schema to complete this example.

18.2 Create a simple report definition

When you create a report, you can either use the Report Wizard to assist you or create the report yourself. In this example, you will use the Report Wizard to create your query and basic report layout.

To create the report definition:

  1. Launch Reports Builder (or, if already open, choose File > New > Report)

  2. In the Welcome or New Report dialog box, select Use the Report Wizard, then click OK.

  3. If the Welcome page displays, click Next.

  4. On the Report Type page, select Create Paper Layout Only, then click Next.

  5. On the Style page, type a Title for your report, select Group Above, then click Next.

  6. On the Data Source page, click SQL Query, then click Next.

  7. On the Data page, enter the following SELECT statement in the Data Source definition field:

    SELECT ALL DEPARTMENTS.DEPARTMENT_ID, EMPLOYEES.FIRST_NAME, EMPLOYEES.LAST_
    NAME, EMPLOYEES.JOB_ID, EMPLOYEES.SALARY, JOBS.JOB_TITLE
    FROM DEPARTMENTS, EMPLOYEES, JOBS
    WHERE ((DEPARTMENTS.DEPARTMENT_ID = EMPLOYEES.DEPARTMENT_ID)
    AND (EMPLOYEES.JOB_ID = JOBS.JOB_ID)) 
    ORDER BY DEPARTMENTS.DEPARTMENT_ID
    


    Note:

    You can enter this query in any of the following ways:

    • Copy and paste the code from the provided text file called graphics_code.txt into the Data Source definition field.

    • Click Query Builder to build the query without entering any code manually.

    • Type the code in the Data Source definition field.


  1. Click Next.


    Note:

    If you are not already connected to a database, you will be prompted to connect to the database when you click Next. Ensure that you connect to a database that has the appropriate schema for this example. Section 18.1, "Prequisites for this example" describes the sample schema requirements for this example.


  1. On the Groups page, click DEPARTMENT_ID and click the right arrow (>) to move this field to the Group Fields list, then click Next.

  2. On the Fields page, move all fields except JOB_ID to the Displayed Fields list, then click Next.

  3. On the Totals page, click Next.

  4. On the Labels page, change the label Department Id to Department, then click Next.

  5. On the Template page, select Predefined Template and click Blue, then click Finish to display your report output in the Paper Design view. It should look something like this:

Figure 18-2 Paper Design view for the graphics report with one query

Text description of orbrgraphics_pap.gif follows.

Text description of the illustration orbrgraphics_pap.gif

18.3 Modify the report in the Paper Layout view

The steps in this section show you how to use the various tools in the Paper Layout view to modify the appearance of your report. First, you will move the existing frames to accommodate the changes you will make. You will then add a title to your report, borders around each record, and change the text color.

To modify your report:

  1. Click the Paper Layout view button in the toolbar to display the Paper Layout view.

  2. Make sure the Confine On button in the toolbar is set to Confine mode on. Doing so allows you to move the objects in the Paper Layout view around the canvas.

  3. In the Object Navigator, under Paper Layout > Body, click the item M_G_DEPARTMENT_ID_GRPFR.

    Notice that, in the Paper Layout view, the outermost frame is selected.

  4. Click on the frame in the Paper Layout view and drag it about two inches down and one inch to the right.

    You can use the rulers along the sides of the Paper Layout view as guidance. Your Paper Layout should now look something like this:

Figure 18-3 Paper Layout View of Adjusted Report Layout

Text description of orbrgraphics_lay.gif follows.

Text description of the illustration orbrgraphics_lay.gif

  1. Now, make sure Flex mode is on and click the Confine Off button in the toolbar to set Confine mode off.

  2. Make space for the border you will create that will surround each record. In the Object Navigator, select M_G_DEPARTMENT_ID_GRPFR again.

  3. Drag each corner to make space around the inner repeating frame, so that the layout now looks like the following image. Notice the white space around the groups.

Figure 18-4 Paper Layout View with Expanded Repeating Frame

Text description of orbrgraphics_lay1.gif follows.

Text description of the illustration orbrgraphics_lay1.gif

  1. Now, let's make space between each record so that we can later put a horizontal line between the records. In the Object Navigator, click R_G_DEPARTMENT_ID.

  2. In the Paper Layout view, click the bottom right corner and drag it down about 0.5 inches so that your layout now looks like this:

Figure 18-5 Paper Layout View with Expanded R_G_DEPARTMENT_ID Repeating Frame

Text description of orbrgraphics_lay2.gif follows.

Text description of the illustration orbrgraphics_lay2.gif

  1. Save your report as graphics_<your initials>.rdf.

18.3.1 Adding a border around the report

Now that you've set up your layout, you can start adding new items. In this section, you will add a border around the entire report.

To add a border:

  1. In the Object Navigator, select the M_G_DEPARTMENT_ID_GRPFR frame.

  2. In the Paper Layout view, while the M_G_DEPARTMENT_ID_GRPFR frame is selected, click the Line Color tool. The tool can be found at the very bottom of the tool palette.

  3. In the color palette that displays, choose the black square to make the border black.

  4. While the line is still selected, choose Format > Line > Line Width > 2 pt.

  5. Now, preview the layout. In the toolbar, click the Paper Design button in the toolbar to run the report to paper. It should look something like this:

Figure 18-6 Preview of the Report with a Border

Text description of orbrgraphics_border.gif follows.

Text description of the illustration orbrgraphics_border.gif

  1. Save your report as graphics_<your initials>.rdf.

18.3.2 Change the font size and style

In the Paper Layout view, you can also change the font and style of the text. The steps in this section will show you how to modify the Department Number text.

To change the font:

  1. In the Paper Layout view, click the Paper Layout button in the toolbar.

  2. In the Object Navigator, select the B_DEPARTMENT_ID and F_DEPARTMENT_ID fields so that you can change the font of the Department ID label and text.


    Note:

    B_DEPARTMENT_ID refers to the boilerplate text "Department ID", which serves as the label for the F_DEPARTMENT_ID field.


  1. Click on the title bar of Paper Layout view to make it the active window.

  2. While the two fields are selected, choose Format > Font.

  3. In the Font dialog box, choose a different font and size. In the example, we chose Times New Roman and 12 pt.


    Note:

    Depending on the font and font size you choose, you may have to adjust the size of the fields to accommodate the text. In the example, since the font was increased, we selected the boilerplate text field and enlarged it.


  1. When you've finished your changes, click OK.

  2. Display your report in the Paper Design view to see what it looks like. Here's an example:

Figure 18-7 Paper Design View of the Report with New Fonts

Text description of orbrgraphics_font.gif follows.

Text description of the illustration orbrgraphics_font.gif

  1. Save your report as graphics_<your initials>.rdf.

18.3.3 Add bullets your report

The steps in this section will show you how to add bullets so that a bullet displays next to each department ID.

To add bullets to your report:

  1. In the Paper Layout view, make sure you have enough space next to the B_DEPARTMENT_ID field where you can add a bullet. The bullet needs to be within the R_G_DEPARTMENT_ID repeating frame so that it displays for each record.

  2. Click the Ellipse tool in the tool palette.

  3. Press the SHIFT key, then draw an ellipse next to the boilerplate text "Department."


    Note:

    Pressing the SHIFT key while you draw the ellipse puts the tool in a "constrained" mode. When you create an ellipse in this mode, you can create a circle. Other tools are similar; for example, constraining the Rectangle tool creates a square. For more information on using these tools, refer to the Reports Builder online help.


  1. You should now see a circle in the repeating frame. To make the bullet a solid color, select the circle, then click the Fill Color tool in the tool palette.

  2. In the color palette that displays, choose black.

  3. Run your report to the Paper Design view to see what it looks like.


    Note:

    When you're checking your layout, make sure that the ellipse displays within the R_G_DEPARTMENT_ID repeating frame.


Figure 18-8 Paper Design View of the Report with Bullets

Text description of orbrgraphics_bullet.gif follows.

Text description of the illustration orbrgraphics_bullet.gif

  1. Save your report as graphics_<your initials>.rdf.

18.3.4 Display a line between each record

When you have a lot of data, you sometimes want to further distinguish each record, so that it's clear how the information is related. In this section, you will add a horizontal line to the layout that will display between each department record.

To add a line separator:

  1. In the Paper Layout view, click the Line tool in the tool palette.

  2. Press the SHIFT key, then draw a line in the R_G_DEPARTMENT_ID frame beneath the fields, like this:

Figure 18-9 Paper Layout View with Line Separator

Text description of orbrgraphics_layline.gif follows.

Text description of the illustration orbrgraphics_layline.gif

  1. Format the line the way you want to appear. In our example, we chose Format > Line Width > 2 pt. Then, we changed the color to black.

  2. Run your report to the Paper Design view. It should now looks something like this:

Figure 18-10 Paper Design View of Report with Line Separator

Text description of orbrgraphics_papline.gif follows.

Text description of the illustration orbrgraphics_papline.gif

  1. Save your report as graphics_<your initials>.rdf.

18.3.5 Add a title to your report

The steps in this section will show you how to use the tools in the tool palette to create a title for your report. You will use the Fill Color to create a black background and white text, as well as arrange your items so they display properly.

To add a title to the report:

  1. In the Paper Layout view, click the Text tool in the tool palette.

  2. Draw a rectangle where you want the title to display. We drew the rectangle above the repeating frames, so that the title would display once, above all the data.

  3. In the new rectangle object, type a title, such as "Employee Details."

  4. Click the Fill Color tool in the tool palette, and choose black.

  5. Click the Text Color tool and choose white.

  6. Click the Rectangle tool, and draw a rectangle around the text.

  7. When you are done, click the Fill Color tool and choose black. Notice how you don't see the text anymore.

  8. In the Object Navigator, find the text object you created under Body. You can tell which objects are text objects by the A icon next to the name. In our case, the text object is B_3.

  9. Once you've selected the object, click the title bar of the Paper Design view to select the Paper Design view.

  10. Choose Layout > Bring to Front.

  11. Run your report to the Paper Design view. It should now look something like this:

Figure 18-11 Paper Design View of Report with Title

Text description of orbrgraphics_title.gif follows.

Text description of the illustration orbrgraphics_title.gif

  1. Save your report as graphics_<your initials>.rdf.

18.4 Summary

Congratulations! You have successfully created a paper report and modified the text color and fill colors, as well as added graphics. You now know how to:

For more information on any of the wizards, views, or properties used in this example, refer to the Reports Builder online help, which you can access in two ways:


Go to previous page Go to next page
Oracle
Copyright © 2002, 2003 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Table Of Contents
Contents
Go To Index
Index