Skip Headers
Oracle® Reports Building Reports
10g Release 2 (10.1.2)
B13895-01
  Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

18 Building a Report with Graphics, Text, and Color

In this chapter, you will learn about reports that include graphics, text, and color. By following the steps in this chapter, you can generate the report output shown in Figure 18-1.

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

Description of Figure 18-1  follows
Description of "Figure 18-1 Graphics, text, and color report output"

Concepts

Data Relationships

This is a one-query group left report.

Layout

This report uses a Group Above layout, which you will modify in the Paper Layout view to make room for the title and company logo. Then, you will import the logo, create the report title, and the rest of the graphics shown in the image above.

Example Scenario

As you build this example report, you will:

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.

18.1 Prerequisites for this example

To build the example in this chapter, you must have access to the Human Resources sample schema (HR) provided with the Oracle Database. If you do not know if you have access to this sample schema, contact your database administrator.

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.


  8. Click Next.


    Note:

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

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

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

  11. On the Totals page, click Next.

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

  13. 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

    Description of Figure 18-2  follows
    Description of "Figure 18-2 Paper Design view for the graphics report with one query"

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 enables you to move the objects in the Paper Layout view around the canvas.

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

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

  4. Using the arrow keys, move the frame about 2 inches (5 centimeters) down and 1 inch (2.5 centimeters) 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

    Description of Figure 18-3  follows
    Description of "Figure 18-3 Paper Layout View of Adjusted Report Layout"

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

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

  7. 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

    Description of Figure 18-4  follows
    Description of "Figure 18-4 Paper Layout View with Expanded Repeating Frame"

  8. Now, let us 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.

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

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

    Description of Figure 18-5  follows
    Description of "Figure 18-5 Paper Layout View with Expanded R_G_DEPARTMENT_ID Repeating Frame"

  10. Save your report as graphics_your_initials.rdf.

18.3.1 Add a border around the report

Now that you have 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 to run the report to paper. It should look something like this:

    Figure 18-6 Preview of the Report with a Border

    Description of Figure 18-6  follows
    Description of "Figure 18-6 Preview of the Report with a Border"

  6. 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 Design 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.

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

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

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

  6. When you have finished your changes, click OK.


    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.

  7. 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

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

  8. Save your report as graphics_your_initials.rdf.

18.3.3 Add bullets to 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 Oracle Reports online Help.

  4. 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.

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

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


    Note:

    When you are 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

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

  7. 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 is 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

    Description of Figure 18-9  follows
    Description of "Figure 18-9 Paper Layout View with Line Separator"

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

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

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

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

  5. 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 Rectangle 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. Click the Text tool in the tool palette, then click in the rectangle and type a title, such as "Employee Details."

  4. With the text object selected, click the Text Color tool and choose white.

  5. With the rectangle object selected, click the Fill Color tool in the tool palette, and choose black.

  6. 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.

  7. Once you have selected the object, click the title bar of the Paper Design view to select the Paper Design view.

  8. Choose Layout > Bring to Front.

  9. 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

    Description of Figure 18-11  follows
    Description of "Figure 18-11 Paper Design View of Report with Title"

  10. 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 Oracle Reports online Help, which is available in Reports Builder or hosted on the Oracle Technology Network (OTN), as described in Section 3.1.1, "Using the Oracle Reports online Help".