|
So, how useful is a report that only displays your customer names? Let's add some useful contact information, such as phone and physical address data. Of course, if you're adding more fields, you'll need to create some more space within the Details section of your report. You can accomplish this in two ways:
The first method is to add more sections to your report (using the Section Expert).
The second method is to manually resize the Details section by adding additional white space.
Both of these methods have their advantages:
Adding multiple sections is often the best solution if you're adding more than one database field to a section.
Adding additional white space is the best choice if you need to enlarge a section (such as making room for larger text). For example, you might stretch the Report Header section to make room for a title in a large font.
Let's look at both of these methods to see how they work and when they work best.
Adding multiple sections provides much more control over your objects than simply resizing a section. For example, if a database field within your report contains no data, you can specify that the section not print, thus eliminating unnecessary blank sections from your report.
Note | A database record that contains no value is said to contain a NULL value. NULL literally means "nothing." Although a NULL value is real in the sense of being recognizable, occupying space internally in a computer and being sent or received as a character, a NULL value character displays nothing and takes no space on the screen (or on a report). |
Crystal Reports allows you to format entire sections of your report utilizing the Section Expert. Some of the functionality of the Section Expert includes:
Inserting, deleting, merging, and moving report sections
Hiding (suppressing) sections from printing
Printing subtotals or group values only at the bottom of the page
Inserting page breaks within the report
Resetting page numbers to 1 after a group value prints
Preventing blank records (or sections) from printing
Printing sections that utilize overlying sections. In other words, a section prints and then all the following sections print on top of that first section. This is used often when printing maps, charts, or pictures within your reports.
Formating a section so that it contains multiple columns (similar to newspaper style)
As you work through this book, you'll work with many of these different features of the Section Expert. For now, let's explore the Section Expert and see how it's used to add additional sections to your report. Perform the following steps:
Select Report, Section from the menu bar.
The Section Expert dialog box displays, as shown in Figure 3-8.
Figure 3-8: The Section Expert dialog
Select the Details section in the list box.
In the list box, you select the section for which you wish to format properties.
In this example, you'll format properties for the Details section of your report. Therefore, you'll need to select the Details section within the list box.
When the Details section is highlighted, press the Insert button (toward the top of the dialog box) five times.
You'll notice additional Details sections are added, as shown in Figure 3-9. The last Details section should be Details f.
Figure 3-9: Adding multiple sections to your report
Press the OK button on the Section Expert dialog box.
You're returned to the Report Design area.
Select the Design tab to view your report in Design mode.
The Customer Name field should reside in the Details a section. The newly inserted sections reside underneath this section (Details sections b through f), as shown in Figure 3-10.
Figure 3-10: Additional Details sections (added using the Section Expert)
From the Field Explorer pane, expand the Database Fields node.
After you expand the Database Fields node, insert the following Customer fields into your report, in the following manner:
Add the Address1 field into section Details b.
Add the City, Region, and Country fields into section Details c.
Add the Postal Code field into section Details d.
Add the Phone field into section Details e.
Leave section Details f blank. Leaving this section blank creates some extra space between records.
Select the Preview tab to preview the results of your work.
Your screen should look something like Figure 3-11.
Figure 3-11: Adding multiple sections to your report
Looking at the results of your work, you may notice that the city, region, and country codes are spaced a little too far apart. Nothing screams "computer-generated report" louder than strange spacing of your data.
You can correct such spacing problems through the use of formulas in a process known as conditional formatting. You'll learn about conditional formatting, as well as more information on the Section Expert, in Chapter 10.
You may have noticed that Crystal Reports separates sections by thick, gray lines. These gray lines determine the default size of the sections. You can move these boundary lines around as you wish, physically controlling how large (or small) you want a report's section.
To add white space to a section, try the following:
Move your cursor pointer over the lower thick, gray line that rests at the bottom of the Details f section.
You'll notice the cursor pointer change into a resizing cursor.
Hold down your left mouse button. With your mouse button held, drag the cursor down to stretch the boundary line.
You'll find the section enlarged.
Once you've done these steps, view your report within the Design tab.
Figure 3-12: Dragging a section's border to create white space
Although dragging the bottom border of a section is the easiest way to add white space, there is another option available (in addition to using the Section Expert). You can add white space to your reports using a horizontal guideline.
We discussed vertical guidelines earlier in this chapter. Horizontal guidelines are similar in the sense that objects snap to them. However, there are two main differences between vertical and horizontal guidelines:
Horizontal guidelines allow you to move objects vertically with precision (instead of horizontally, like the vertical guidelines).
Horizontal guidelines are added manually to a report (rather than generated automatically, like the vertical guidelines).
Each time you add a horizontal guideline to a section, the section grows. Thus, horizontal guidelines are another way to increase the white space in a section. To add a horizontal guideline to a section (and therefore increase the amount of white space), perform the following steps:
Right-click in the gray section name on the left side of the Report Design area. An options menu displays.
In this example, right-click in the gray portion of the Details f section (near the text that reads "Details f"). Figure 3-13 on the following page displays a menu of options available from the sections.
Figure 3-13: Accessing a section's options menu
This options menu contains four features for horizontal guidelines: Insert Line, Delete Last Line, Arrange Lines, and Fit Section. Select Insert Line.
Table 3-3 displays the horizontal guideline functionality available from the section's options menu.
Horizontal Guideline Option | Description |
---|---|
Insert line | Adds additional horizontal guidelines to a section, enlarging the size of the section. |
Delete last line | Removes the last horizontal guideline within a section, shrinking the size of the section. |
Arrange lines | Rearranges the horizontal guidelines within a section so that they contain equal space between. |
Fit section | Shrinks the size of the section to the lowest object within the section. Any guidelines that exist below this lowest object are removed. |
Select the Insert Line option three times.
Your screen should look something like Figure 3-14.
Figure 3-14: Using horizontal guidelines to add white space
|