Chapter 2 - Learning the Report Designer


See how to set the designer's properties and how to setup the report's basic structure. Secondly, you learn how to add and manipulate report objects within the designer. The tutorials give you practice creating and modifying the many report objects.

Become a Crystal Reports expert with the authoritative resource available. The tuturials and tips in this book will take your skills to the next level.
Buy at

This is an excerpt from the book Crystal Reports Encyclopedia. Click to read more chapter excerpts.

Fields that Can Grow

When working with database fields, it's common to show fields that display a large amount of data. For example, an inventory table can have a Description field that stores a lot of data. Depending upon the inventory item, some descriptions will be short and other will be long. When you add the Description field to the report, you want to make it tall enough to display multiple lines of information, but this will leave a lot of empty space for the short descriptions. The way to solve this problem is to make the field only one line tall and enable the Can Grow option. The Can Grow option lets the field expand to as many lines as necessary so that the full field is displayed. The Can Grow option is located on the Common tab of the Format Editor.

Note
Fields can only grow taller. They won't grow wider.

The next two figures illustrate printing a person's first and last name as well as some notes about the person. The first figure shows the fields in the Design window. Notice that the Notes field is only one line tall. Although you can't see it here, the Can Grow option has been enabled for the Notes field. The second figure shows the preview of the report. Notice that the Notes field has grown so that all the data can be displayed.

Figure 2-17. A Can Grow text object in design mode.

Figure 2-18. The text object displaying multiple lines of text.

Sometimes there can be so much data in a field that displaying it causes the report to look unusual and could even span over multiple pages. As a precaution to make sure the field doesn't grow too large, there is a property to set the maximum number of lines. It is also on the Common tab of the Format Editor and located next to the Can Grow checkbox. By default, the number of lines is set to zero which effectively disables the option and there is no limit. If you want to set a limit, then override the zero with the maximum number of lines. The field height will not exceed the number specified.

One thing to be aware of, if another field is located below a field that has the Can Grow option enabled, then it's possible that the top field will expand over the field below it and overwrite it. There are two ways to prevent this. First is to make sure that no fields are close enough to the Can Grow field that they might be overwritten. This isn't a very practical solution because it requires leaving a lot of blank space between the fields. The second option is to put the Can Grow field at the bottom of the section, so as the field grows the section enlarges to compensate for the extra lines needed. The data in one section won't overwrite the data in the next section. If it isn't practical to put the Can Grow field at the bottom of the section, then insert another section below the current section and put the extra fields in the new section. This trick is discussed in Chapter 8.

One final feature of the text object is that you can import an external text file into it. Double-click on the text object to go into edit mode. Then right-click on it and select Insert from File. This opens the File Open dialog box that lets you select the text file. The file's content gets inserted into the text object.


To read all my books online, click here for the Crystal Reports ebooks.