Positioning and Sizing Report Objects

After you have completed your functional report design tasks connecting to the data source, adding report objects, and structuring the report formatting the various objects on a report is the natural next step in the report design process. As demonstrated in Hour 5, "Creating and Designing Basic Reports," objects can be added to a report via a variety of methods dragging and dropping objects from the design explorers or selecting objects from toolbar and menu commands and placing them in the desired locations within the report sections for 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 8.1 and 8.2. These two reports accomplish the same functional tasks, but the report in Figure 8.2 is much more visually appealing.

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

graphics/08fig01.jpg

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

graphics/08fig02.jpg

We will spend the remainder of this hour reproducing many of the applied visual elements of the latter report example. By completing the following exercises, you will create your own version of the 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, formatting the font styles of the report title, column titles, country description, and email address fields to make for a more precise presentation of the report information. By combining the Country database field with a text field, you will also provide for a bilingual display of the country description.

Let's begin the design of our report. The following steps will enable you to create your own Customer Contact Listing report:

  1. Open the Crystal Reports application and select 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, as shown in Figure 8.3. Click OK to continue.

    Figure 8.3. Select the Customer table from the Xtreme Sample Database list.

    graphics/08fig03.jpg

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

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

    graphics/08fig04.jpg

  6. Follow the previous step to add the Contact First Name, City, and Email fields to the Details section of the report, as shown in Figure 8.5.

    Figure 8.5. Position the displayed fields within the respective sections of the report.

    graphics/08fig05.jpg

  7. From the Insert menu, select Text Object and drop the object in to the middle of the Report Header section (as shown in Figure 8.5) and type Customer Contact List 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, it's time to focus on positioning and resizing these fields for display purposes.

  1. As Figure 8.5 shows, you might not be able to see the entire text entered in to the report title text object because it is not wide enough to display your text entry. 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 8.6 to see the result of this action.

    Figure 8.6. Your report should now display five database field objects in the Details section and one text object in the Report Header section.

    graphics/08fig06.jpg

    graphics/bookpencil_icon.gif

    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.


  2. 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. Figure 8.6 shows the result of this action.

  3. Using the Field Explorer (as discussed earlier), 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 8.6.

    graphics/bookpencil_icon.gif

    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 Email 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's best to use the report's Preview tab as a guide to formatting the layout of your reports.


  4. Now click the Preview tab to see a preview display of what the report will actually look like, as shown in Figure 8.7.

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

    graphics/08fig07.jpg

graphics/bookpencil_icon.gif

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 run the Refresh toolbar icon is represented with a yellow lightening bolt.


graphics/bookpencil_icon.gif

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. See Hour 19, "Designing Effective Report Templates," for more details on designing and using report templates.




Sams Teach Yourself Crystal Reports 9 in 24 Hours
Sams Teach Yourself Crystal Reports 9 in 24 Hours
ISBN: B003D7JUVW
EAN: N/A
Year: 2005
Pages: 230

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