Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

2.10 String Formatting

Formatting Strings

String output can be formatted in a way similar to formatting a cell in a spreadsheet. You can modify its font and border. There are also formatting options that are specific to Crystal Reports. These options consist of suppressing the field, letting the width grow, rotating the text, paragraph specific formatting and hyperlinks. Almost every option on this dialog box can be set using formulas. This is discussed in more detail in Chapter 7. The formatting options are available for textbox objects, formulas, report fields, and special fields. Access the formatting dialog box by right-clicking on the field and selecting Format.

The first tab of the Format Editor dialog box is the Common tab (see Figure 2-16). The properties shown on this tab are common to most of the report objects available. These properties are described in Table 2-2.



Figure 2-16. The Common tab.
Table 2-2. Properties of the Common Tab

Property Description
Can Grow Allow the field to expand if the object isn’t big enough to hold the data. The field will only expand vertically and result in the height increasing. The width does not expand.
Close Border on Page Break If a field has a border, and the field extends to another page, then this will close the border on the first page.
Horizontal Alignment Sets the alignment to Left, Right, Center or Justified.
Keep Object Together Do not let the object cross over into another page.
Suppress Hides the object.
Suppress If Duplicated Hide the object if it had the same value in the prior record.
Text Rotation Rotate the text to a specified angle. A value of 0 is the default and the text displays horizontally. A value of 90 rotates it vertically upward. A value of 270 rotates it vertically downward.
Tool Tip Text Use the formula editor to set a string that is displayed when the mouse hovers above the field.

The next two tabs on the Format dialog box are the Border tab and the Font tab. Both of these tabs are simplistic and don’t have anything unusual in them. The Border tab lets you specify which sides should have a border and it also lets you can change the shading around the object. The Font tab has properties to change the font and use different effects such as strikethrough and underline.

The third tab of the dialog box is the Paragraph tab. This is useful when using multi-line objects and you want it to be formatted like a standard paragraph (see Figure 2-17). It lets you customize the indentation on the left and right sides. You can also specify a different indentation for the first line so that it is inset from the rest of the lines. You can also set the line spacing, the reading order (left to right or vice-versa), and specify if it uses plain text or text formatted as RTF.



Figure 2-17. The Paragraph tab.

The last tab is the Hyperlink tab. This is used for fields that store text to be used as a hyperlink to a website, an email address, a file, or another report. When you select what type of hyperlink it is, the middle frame changes so that you can enter the appropriate type of link. You can either hardcode the hyperlink or use the formula editor to make it dynamic depending upon what is in the field. Depending on the type of object, the hyperlink tab might be unavailable.