Crystal Reports, as a Windows-based report writer, has many features that can help you create eye-catching, visually effective reports. You can often use Crystal Reports to create reports right from the database, whereas you formerly had to use a word processor or page publishing program to create such reports. The next time you re tempted to export database records to a text file and merge them in a word processing or page publishing document, use some of the techniques covered in this chapter and save the extra work.
You may consider using geographic maps (discussed in Chapter 4) and charts and graphs (discussed in Chapter 12) as visual elements to make your reports more appealing. But even using just the textual elements of Crystal Reports can be very creative. Not only can you use a variety of fonts and typefaces in your reports, you also can set object foreground and background colors, choose unique borders on all four sides of objects, add drop shadows, and use other graphical features. You can include bitmap pictures on your report, either reading them directly from the database (if the database you re using supports and includes them) or adding graphics files right into a report section. You can draw lines and boxes around the report to highlight important portions. You can use Report Alerts to trigger a message when a certain condition is met, as well as highlight portions of the report that met that condition. You can choose a predefined set of object and report formatting and apply it to other reports in one step by use of templates. And, one of the most often requested features of office suite programs, the Format Painter, has finally made it into Crystal Reports 10.
Crystal Reports gives you considerable flexibility in customizing the appearance of objects that you place on your report, such as database fields, text objects, and formulas. By using various formatting options for these objects, you can change many aspects of their appearance, such as font face, size , color , alignment, and more. The most basic type of formatting is known as absolute formatting, in which you simply select the object and make formatting changes with the Formatting toolbar or the Format Editor. In either case, the change applies to all occurrences of the object on the report ”if you format a field in the details section absolutely , that field will appear the same every time it prints.
The quickest way to format one or more objects on the report is to select the object or objects you want to format and then choose options from the Formatting toolbar. To choose a single object, just click it with the mouse. To choose multiple objects to format at once, CTRL-click or SHIFT-click on more than one object (you ll notice that all objects you ve selected will have a shaded outline around them). Then, click buttons in the Formatting toolbar to format the selected objects. Table 9-1 outlines each Formatting toolbar button.
Button | Function |
---|---|
Font Face | Choose a different font face (such as Arial, Times Roman, etc.) from the drop-down list. |
Font Size | Choose the font size, in points, from the drop-down list, or enter a value directly in the box. |
Increase Font Size | Increase the font size (each click of this button increases the font size by one point). |
Decrease Font Size | Decrease the font size (each click of this button decreases the font size by one point). |
Bold | Format object using bold emphasis. |
Italic | Format the object using italic letters . |
Underline | Add an underline to the object. |
Left Align | Align text to the left of the object's defined width. |
Center Align | Align text to the center of the object's defined width. |
Right Align | Align text to the right of the object's defined width. |
Full Justify | Align on both the left and right side of the object's defined width. This provides fully justified text, similar to that often found in newspaper columns . |
Font Color | Change font color. If you click the button itself, it will set the font color to that displayed on the small line in the button. If you click the down arrow, a dialog box will appear giving you a choice of colors. Once you choose a color that becomes the default color for the button, you will see the small line in the button change color. |
Outside Borders | Add border lines on sides of object. If you click the face of the button, all four sides of the object will initially be given a border. If you click the face of the button again, the borders will be turned off. If you click the down arrow, a subset of buttons will appear, which allow you to choose combinations of left, right, top, or bottom borders, all, or none. |
Suppress | Toggle display of the object on and off. This is equivalent to clicking the Suppress check box on the Common tab of the Format Editor. |
Lock Format | Toggle ability to change other formatting properties on the object. If formatting is locked, all other formatting options, including width and height, will be disabled. This is equivalent to clicking the Read Only check box on the Common tab of the Format Editor. |
Lock Size/Position | Toggle ability to change the width or height, or to move the object. This is equivalent to clicking the Lock Position and Size check box on the Common tab of the Format Editor. |
Currency | Toggle display of a currency symbol (the symbol chosen as the default currency symbols in the Windows Control Panel) with the object. This button will be enabled only if all objects you've selected are currency or numeric fields. |
Thousands Separator | Toggle display of a thousands separator (the symbol chosen as the default thousands separator in Windows Control Panel) within the object. This button will be enabled only if all objects you've selected are currency or numeric fields. |
Percent Sign | Toggle display of a percent sign on the right side of the object. This option actually adds a currency symbol, but it changes the symbol to the percent sign and the position to the right side of the object. This button will be enabled only if all objects you've selected are currency or numeric fields. |
Increase Decimals | Increase the number of decimal places displayed. For example, if the object is displayed as $121.22 and this button is clicked, the number might display as $121.223. This button will be enabled only if all objects you've selected are currency or numeric fields. |
Decrease Decimals | Decrease the number of decimal places displayed. For example, if the object is displayed as $121.22 and this button is clicked, the number will display as $121.2. This button will be enabled only if all objects you've selected are currency or numeric fields, and if at least one decimal place is already showing. |
Although Crystal Reports offers a large number of formatting choices on the Formatting toolbar, there are still quite a few formatting options that you can t perform with toolbar buttons. For these formatting requirements, you must use the Format Editor. The Format Editor is not an editor per se, but a tabbed dialog box that displays a varying set of tabs, depending upon the data type of the object you re formatting.
To display the Format Editor, select objects as described earlier in this chapter and then choose one of the following options:
Choose Format Format Text, Format Format Field, or Format Format Objects from the pull-down menus (the choice of Text, Field, or Objects is determined by the number and data type of objects selected before you choose the option).
Right-click the selected object and choose Format Text, Format Field, or Format Objects from the pop-up menu.
Click the Format toolbar button in the Expert Tools toolbar.
The tab that displays in the Format Editor will vary, depending on the data type of the object you re formatting. For example, if you selected one or more date/time fields before displaying the Format Editor, the Date/Time tab will initially display. Number fields will result in the Number tab displaying, and string fields or text objects will cause the Paragraph Formatting tab to initially display. If you select multiple objects of varying data types, the Common tab will display by default, and you ll be able to change only formatting options that apply to all objects you ve selected: data type “specific options will be unavailable until you cancel the Format Editor, select one or more objects with the same data type, and re-format them.
In some of the Format Editor tabs (such as the Number tab or Date/Time tab), you ll be able to choose from predefined formatting styles that appear in a list. These styles provide more commonly used formatting styles that you may select with one mouse click. If, however, you d like to use some combination of formatting that these styles don t provide, a Custom Style button at the bottom of the Format Editor will display additional dialog boxes where you can format individual pieces of the field, such as the leading day-of-week for a date field, or the currency symbol for a number or currency field.
Most Format Editor options are fairly self-explanatory in terms of the data type being formatted. For those options that aren t self-explanatory, Crystal Reports online help will provide additional information. Also, additional discussion of various Format Editor options can be found throughout this book in sections and chapters relating to the different types of fields being formatted.