Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

2.03 Setting the Default Format Options

Setting the Default Format Options

After adding fields to a report, you frequently have to format each one to the proper font, alignment, format, etc. If you need to format report objects a particular way for multiple reports, you can set the default properties that are applied to each field. This saves you work because their default formatting is applied when the report object is added to the report.

The Options dialog box has two tabs that set formatting properties. The first is the Fields tab shown in Figure 2-3.



Figure 2-3. The Fields tab sets the default formatting properties.

The Fields tab controls the default formatting based upon field type. For example, the formatting for a String field is different than the formatting of a Boolean field. By clicking on the button for each type of field, the Format Editor dialog box appears. This dialog box has more tabs for setting properties such as Can Grow, Alignment, CSS Class, Border styles, etc. Set the properties that you want to be the default and then click the OK button. The next time that you add that field type to your report, the formatting properties will already be set.

Not all formatting options apply to each type of field. For example, the String object doesn’t need to specify the default date format. Thus, the date related formatting options are only shown for Date fields. Setting the default properties for some objects is more useful than for other objects. For example, the String object lets you set properties such as Suppress, Can Grow, Text Rotation, and the line styles of the border. Each of these properties is really only used in unique circumstances and therefore isn’t something that generally gets set as a default property. On the other hand, the way you format a Date object is usually the same throughout all your reports. For example, a company might have a policy that all dates show the month using three letters and the year is four digits. This isn’t going to change so it’s a good idea to set it as the default. The same applies to how numbers and Boolean values are displayed.

The second formatting related tab within the Options dialog box is the Fonts tab. It lets you set the default font style depending upon what the field represents. You can set the font for Summary fields, Group Name fields, Field Titles, etc. For example, it’s very common for a summary field to have different font properties than the group name field. Setting the default font properties saves you time when designing reports and apply consistent formatting rules to different parts of the report.



Figure 2-4. The Fonts tab formats different field objects.

The default formatting settings are only applied to an object when it is initially dropped onto the report. If you later change the default formatting, these changes are not applied to objects already on the report. To apply the default settings to an existing object, you have to delete the object and then add it back to the report.