Positioning and Sizing Report Objects

After you have completed your functional report design tasksconnecting to the data source, adding report objects, and structuring the reportthe next step in the report design process is to format the various objects on a report. As demonstrated in Chapter 1, "Creating and Designing Basic Reports," objects can be added to a report via a variety of methodsdragging and dropping objects from the design explorers or selecting objects from toolbar and menu commands and placing them in the desired locationsfor quick and intuitive report creation. Upon successfully adding objects to your report, each of the respective objects can be positioned, sized, and formatted for display purposes, as demonstrated in the following exercise.

As a visual example of the difference that report formatting efforts can make, compare the presentation value of the report samples shown in Figures 6.1 and 6.2. These two reports accomplish the same functional tasks, but the report in Figure 6.2 is much more visually appealing.

Figure 6.1. A customer contact listing report with little to no formatting applied.

graphics/06fig01.jpg

Figure 6.2. A customer contact listing report with a moderate amount of formatting applied.

graphics/06fig02.jpg

You will spend the remainder of this chapter reproducing many of the visual transformations from Figure 6.1 to Figure 6.2. By completing the following exercises, you create a Customer Contact Listing report using a variety of applied formatting techniques, such as adding a group definition to logically structure customers into their respective countries, and formatting the font styles of the report title, column titles, country description, and e-mail address fields to make for a more precise presentation of the report information. By combining the Country database field with a text field, you also provide for a bilingual display of the country description.

To begin designing your report, follow these steps to create your own nicely formatted Customer Contact Listing report:

  1. Open the Crystal Reports application and choose to Create a New Report Using the Blank Report Layout from the Report Gallery dialog.
     
  2. From the Database Explorer dialog, expand the Create a New Connection list, and then expand the ODBC (RDO) node to present the ODBC dialog window that lists the available data sources. Select the Xtreme Sample Database from the list of data sources and click Finish to continue to the Database Expert dialog.
     
  3. From the Database Expert dialog, use the arrow (>) button to add the Customer table to the Selected Tables list on the right. Click OK to continue.
     
  4. From the View menu, select the Field Explorer command to open the Field Explorer dialog.
     
  5. From the Field Explorer, click and drag the Contact Last Name field onto the report's design view and place it to the far left of the Details section area, as shown in Figure 6.3.
     

    Figure 6.3. Add the Contact Last Name field to the Details section of the report.

    graphics/06fig03.jpg  
  6. Follow the previous step to add the Contact First Name, City, and E-mail fields to the Details section of the report, as shown in Figure 6.4.
     

    Figure 6.4. The selected fields displayed within the respective sections of the report and a floating Field Explorer dialog.

    graphics/06fig04.jpg

     
  7. From the Insert menu, select Text Object and drop the object into the middle of the Report Header section (as shown in Figure 6.4) and type Customer Contact Listing in the text field. Click anywhere outside the text object to remove the cursor focus from the text object.

    Now that the report includes the field and text objects identified previously, focus on positioning and resizing these fields for display purposes.
     
  8. As Figure 6.4 shows, you might not be able to see the entire text entered into the report title text object because it is not wide enough to display the text entry by default. To resolve this, click once on the report title text object located in the Report Header section so that it becomes highlighted. Using the dark blue handles that encompass the objects perimeters, float over the handle located on the right side of the text object with the mouse pointer; then click and hold the mouse button while dragging the handle farther to the right to widen the text object's display area. Refer to Figure 6.5 to see the result of this action.
     

    Figure 6.5. The sample report displays five database field objects in the Details section, five database field column header text fields in the Page Header, and one text object in the Report Header section.

    graphics/06fig05.jpg  

    NOTE

    Notice that when you float over the perimeter handles of an object with your mouse cursor (or pointer), the cursor icon turns into an alternative shape, such as horizontal or vertical arrows, to illustrate that you can modify the object if you click on the handle.

  9. Now that you have widened the display area of your report title object using the concept of object handles, repeat this same step to modify the width of the field objects within the Details report section so that you can insert one additional object into the Details section of your report between the City and E-mail fields.
     
  10. Using the Field Explorer, insert the Phone database field from the Customer table into the Details section of your report. Based on the previous steps, practice positioning and sizing the objects in the Details section to accommodate for all the database fields, as shown in Figure 6.5.
     

    TIP

    Although many formatting activities can be exercised on field objects in both the design and preview tabs, some formatting facilities are only available within the Design tab. One useful feature to take note of is the capability to move a highlighted field (or even a set of fields) and its associated column title with the arrow keys on your keypad. This technique is a great help when you're moving report fields around as you did in step 9.

    NOTE

    As you might have noticed, the field sizes are often large enough to show the entire field name in the Design view of the report. But from the Preview tab view of the report, you see that fields (such as the E-mail or Phone fields here) are cut off from the display area. This is not unusual, and it might require you to resize the field objects to ensure that they are appropriate for the report display area. It is often useful to use the report's Preview tab as the active window when finalizing the formatting and layout of your reports.

  11. Now click the Preview tab to see a preview display of what the report actually looks like, as shown in Figure 6.6.
     

    Figure 6.6. To preview your report, either select the Preview tab or click the Refresh button.

    graphics/06fig06.jpg  

NOTE

If the Preview tab is not displayed in the application, you have not yet run the report against the database. To run the report, click the Refresh toolbar icon to execute the report to runthe Refresh toolbar icon is represented with a yellow lightning bolt.

NOTE

Although it's important to understand the basics of report formatting, you will not necessarily have to go through the often arduous process of formatting reports every time. Report templates can be used to apply predefined and meaningful formatting characteristics in a very quick manner.

For more details on designing and using report templates, p. 300






Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net