Hack #38. Save Paper by Reducing Whitespace

Use the Can Shrink property to condense your reports.

Empty data fields in a long report can pose a problem when it comes time to print the report. Imagine a list of 1,000 contacts, and only half have a phone number entered into a phone number field. When you designed the report, you included the phone number field for contacts that have a phone number. However, when you print the report, you see 500 empty spaces representing the phone number fields of customers without phone numbers. When other data fields are empty as well, the situation just gets worse.

All told, this whitespace can account for 50 or more extra pages in the report, depending on how the report is laid out. Figure 4-35 shows a report that suffers from this problem. Some contact information is missing, yet room is still set aside for it.

A waste of paper

Figure 4-35. A waste of paper

Figure 4-36 shows the design of the report. The detail section contains a group of fields. As shown in Figure 4-35, some of the fields are empty.

Setting the Can Shrink property

Figure 4-36. Setting the Can Shrink property

On the property sheet, set the Can Shrink property to Yes. Apply this to the fields in the detail section and to the detail section itself.

Tip

When you use the Can Grow or Can Shrink properties, you must apply the settings to both the bound controls and the detail section.

With Can Shrink set to Yes, any empty data fields on this report won't take up space. Figure 4-37 shows the improved report.

A more compact report

Figure 4-37. A more compact report

In that figure, you can see some contacts are missing a phone number, and others are missing all the data. In both cases, the amount of empty space shrinks. As you can see when comparing the report in Figure 4-37 with the one in Figure 4-35, even the first page displays more contacts. As wasteful whitespace is dropped, the number of pages on the report is reduced.

The Can Grow property provides the opposite functionality as well. When designing a report, place controls where they make the most sense. Occasionally, you might have more data than you can display in the field, given the size of the bound control. Setting Can Grow to Yes lets the field expand as needed to print all the data.

Get Access Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.