Formatting Report Sections

The earlier chapters introduced the concept of report sections such as the detail section and the group header and footer sections. Report sections segment reports into logical areas to facilitate logical report design. Report sections are identified by name on the left side of the design environment, and, by default, each report includes a Report Header and Footer, Page Header and Footer, and Details section. If you have inserted any groups into your report, you also have a Group Header and Footer for each defined group item. As reports have been created in the previous chapters, objects such as database fields, text fields, and corporate logo images have been placed into the various report sections and organized based on the report design requirements.

Each section has unique display properties and printing characteristics that can be modified. For example, if a report object, such as an image, is placed in the Report Header section, the image displays and prints only once per report, on the first page. If the same image is placed in the Page Header section, the image then displays and prints once for every single page of the report. The same principals hold true for other custom sections, such as Group Headers and Footers. Finally, the Detail section implies that whatever is placed in this section displays, and prints, once for each and every row retrieved from the data source.

NOTE

The Crystal Reports design environment is built on a paper metaphor with pages the driving concept in structuring the presentation of report information. This page metaphor applies when referencing report printing and with respect to various presentation characteristics of report formatting.

Using the report created in Chapter 6, take a closer look at how to format report sections. The following exercises demonstrate how to format sections such as the Group Header and Group Footer to improve the overall presentation of a Crystal Report. In addition to modifying display properties, conditional logic is also applied that modifies the behavior of the Page Header section based on the result of the defined condition (format formula). The Section Expert is the central location for working with all report section properties, and it is used to view and modify the properties of each report section throughout the following exercises.

NOTE

As you might have noticed, long names (descriptive names) of each section are provided to the left of the design environment within the Design tab, whereas only the short names (abbreviated names) of sections are presented while viewing reports from the Preview tab. This maximizes the report viewing space while working in the Preview tab. The long names can, however, be accessed by either hovering the mouse cursor over the section or by right-clicking on the section name (or label).

There are three distinct ways to access the Section Expert; these include

To start the hands-on learning, follow these steps:

  1. Open the report you created in Chapter 6. Alternatively, open the report entitled Ch07start.rpt (available by searching for the book's ISBN0-7897-3113-4 at Que Publishing's Web site, www.quepublishing.com).

     

  2. Open the Section Expert. From either the Design or Preview mode, right-click on the Group Header #1 section and select Section Expert from the pop-up menu. This presents the Section Expert dialog displayed in Figure 7.4.

     

    Figure 7.4. The Section Expert provides access to a variety of section formatting properties, as well as enabling the specification of what happens before and after each section is printed.

    Now apply a background color to your Group Header #1 report section so that the report consumers can quickly distinguish between country sections and determine which customer contacts belong to each country.

     

  3. In the Section Expert, select the Group Header #1 item from the Sections list on the left, and then click on the Color tab on the right. Click on the Background Color box so that it is activated and select Navy from the drop-down list of color options. Click OK to continue.

     

    TIP

    From within the Section Expert, you can easily navigate from modifying the properties of one report section to another without closing this dialog window. Regardless of how you open the Section Expert dialog window, you can quickly toggle to other report sections, providing a central location to access and modify the properties of all report sections.

  4. Select the Preview tab to view your report display.

     

  5. The Red font used for the object in the Group Header #1 does not look good against the Navy background color. To resolve this, highlight the text objectactually a combined object consisting of a text object and a database field objectand change its font color to White, as shown in Figure 7.1.

     

    Figure 7.1. Formatting a report section can make reports more readable and friendly to end users.

     
  6. To complement the current report grouping on the Country field, add a summary count of the contacts for each country in the Group Footer #1 section. To do this, select Summary from the Insert menu to present the Insert Summary dialog and select the following items:

     

    • Customer.Contact Last Name field from the Choose the Field to Summarize drop-down list
    • Count from the Calculate This Summary drop-down list
    • Group #1: Customer.Country from the Summary Location drop-down list

    NOTE

    To access the Insert Summary dialog so that you can add a summary field to your report, you can use the Summary command from the main Insert menu, you can use the Insert Summary button located on the Insert toolbar, or you can simply right-click on any report field already in the report and access the Insert Summary menu option from the right-click menu. This last option prepopulates the Choose the Field to Summarize drop-down box and saves you a few needless steps.

  7. After you have made these selections from the Insert Summary dialog, click OK to continue.

     

  8. You should now see the Count Summary field listed in the Group Footer #1 section of your report. To align the field values to the left and make them noticeable, use the Align Left and Font buttons located on the Formatting toolbar to apply the desired alignment and a Red font color.

     

  9. Now add additional report section formatting to the Group Footer #1 section. From the Report menu, select the Section Expert command to present the Section Expert dialog. From the Sections list on the left, select Group Footer #1 and then select the Color tab on the right. Specify a Silver background color for this section and click OK to return to the report preview, shown in Figure 7.2.

     

    Figure 7.2. Section formatting can be applied specifically to the various sections of your report for a more meaningful report presentation.

     
  10. As a final step, change the font color of the database field column titles. From either the Design or Preview view, right-click on the Page Header section title and choose Select All Section Objects from the pop-up menu. After all the column title objects are highlighted, select Teal from the formatting toolbar Font Color button.

     

As you have seen, formatting the various sections of your report is very straightforward. Each section has unique and specific properties that can be modified and used collectively to enhance the presentation quality of the entire report.

TIP

To quickly remove blank space within report sections and tighten up the alignment of the objects positioned within the sections, you can use the Fit Section command. The Fit Section command is available from the right-click menu of each report section. This raises the bottom boundary line and reduces unnecessary space within the section.

Категории