Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

2.11 Text Object, Field Object, Line Object, and Box Object

The Text Object

The text object is used to display text, database fields, and special report fields. Each text object can display one of these or a combination of all three. After adding a text object to the report, click on it to edit it.

When writing form letters, using the textbox object with a combination of text and database fields is very helpful. Text in form letters is different than standard reports because it doesn’t follow the standard format of showing individual rows and columns. It is displayed in paragraph format with a single space between each word/number. The textbox makes this possible by automatically trimming the spaces around each word and number. Thus, you can insert database fields in with standard text. Any extra spaces around the database fields are not shown. If you have ever programmed in HTML, then you are familiar with this concept. Within HTML, no matter how many spaces you put between words, they will be separated by only one space.

The properties that apply to the Textbox object are covered in the section Formatting Strings.

The Field Object

The standard field object displays data from a table or a formula. The field object is added to your report by dragging and dropping it from the Field Explorer window onto your report. The Field Explorer window is normally docked on the toolbar to the left side of the screen. If you don’t have it there, you can pull it up by clicking on the menu items and selecting View/Other Windows/Document Outline. The properties that apply to the field object are covered in the Formatting Text Objects section.

The Line Object

The line object does exactly what you expect; it draws a line. There isn’t a whole lot you can do with this except change its color, the width and its style (single line, dashed line, etc.) It does have one interesting feature that solves a common problem with line objects. The problem occurs when you draw a vertical line on a detail section. There are times when the detail section has a field that can grow down the report and make the section longer than expected. You expected the line to be unbroken down the report and now that isn’t the case because the line is too short. To fix this, set the property ExtendToBottomOfSection to True. This insures that no matter how short your line is, the end point will be the bottom of the section. If it is a horizontal line, this always moves it to the bottom of the section.

The Box Object

Like the Line object, the Box object isn’t too exciting. You can change its color, width and style. One nice feature about it is that you can change its properties to round the edges. Depending on how you set the properties, you can make it elliptical or even turn it into a circle. The properties that affect this are CornerEllipseHeight and CornerEllipseWidth. Rather than modify these directly using the Properties window at the bottom right hand corner of the screen, it is much easier to use the Format dialog box. The second tab is the Rounding tab. It has a picture of what the box looks like and below it is a slider. As you move the slider from the left to the right, it increases the curvature of the edges. When the slider is at the far right, the box has turned into a circle. Once you click OK, the dialog box modifies the corner ellipse properties for you.