How to format fields in a Crystal Report

In order to achieve customization goals it's sometimes required to format report fields in a specific way. Have you ever read a report full of good information, yet lacking in its presentation? Perhaps the totals were hard to find. Maybe the columns ran together, or the font was too small. Displaying totals in a different color, underlining important results, or displaying grand totals in different fonts or sizes can greatly affect the impact of your document. Crystal Reports allows you to easily change the format of a field or group of fields.

A field's format includes its font, size, color, height, and alignment. When you place fields on a report, they inherit the default formats set on your workstation. Setting your own default formats allows you to establish a common "look" for your reports. These settings are stored on your workstation, so every report you create uses the same default formatting options.

To set field default formatting, select File, Options from the menu bar and click the Fields tab. Field formats are set based on the field type you select. There are five field types: String, Number, Currency, Date, and Boolean. String fields contain alpha-numeric data, e.g., Last Name, Phone Number, and Constituent ID. Number fields contain numeric data only. Currency fields contain currency data, e.g., Gift Amount, Total Amount, etc. Date and Time fields reflect date and time data. Boolean fields contain binary data, such as "Yes/No," "True/False," or "1/0." Select a field type. The Format Editor screen appears.

Article
Number:46089

Products:

Crystal_Reports

Right click on the desired field in the report and select Format Field. Details on the various options available for formatting is presented below:

String or Text Fields

Common tab

Suppress is useful for hiding formulas used for calculations in the report or fields used for sorting purposes. This option is disabled when setting default formatting, but can be set on a field-by-field basis.

Horizontal Alignment aligns the field to the left, center, right, or justified.

Keep Object Together keeps the entire section on the same page.

Close Border on Page Break creates a horizontal line at the start or completion of a page.

Can Grow allows the field to expand to include extra lines of information.

Suppress if Duplicated eliminates multiple printings of the same data. This is useful for fields placed in a report's Details section because these fields are often duplicated. For example, if you place Constituent Name and Gift Amount side by side in the Details section, the donor's name repeats for each gift given. If you select this option, each constituent name appears only once on the report.

Alignment sets the justification of a field on the report. Possible choices are:

Default: Left justified for date, text, and Boolean fields and right justified for currency and number fields

Left: Flushes the first character against the left margin

Centered: Centers the characters in the field

Right: Flushes the last character in the field against the right margin.

On the Border tab, you can select to place lines around the field. There are also options for specialized formatting such as Drop Shadow, which places a shadow on the field and border and background colors.

Number and Currency Fields

The Common tab contains the same options as the String Fields Common tab.

Number tab

Use System Default Format uses the default Windows settings for this information.

Suppress if Zero hides the field if the amount is $0.00.

Decimals allows you to format the number of places before the decimal.

Rounding allows you to round a number off by a specific decimal place.

Negatives is how negative numbers are formatted.

Currency Symbol tab

Mark the Enable Currency Symbol checkbox to choose between a fixed placement of the currency symbol or to have it "float" with the size of the value.

One Symbol Per Page allows for only one currency symbol used per column per page.

Position sets the position of the symbol in relation to the value.

Currency Symbol is used to specify any character to use for the actual system.

Date, Time, and Date/Time Fields

On the following screens are available formatting options for date and time settings.