Common Formatting Features
The most common formatting feature is changing font color or font face. This can be done by choosing the features directly on the Formatting toolbar, as shown in Figure 9.1.
Figure 9.1. The Crystal Reports Formatting toolbar lets you change object formatting.
Chapter 6 introduced the Highlighting Expert. I will assume that you have already learned the fundamentals of the highlighting expert.
Working with ToolTips
All report objects can have rollover text or ToolTips available when the report is viewed. For example, if you would like to use descriptive text to explain why a certain formula was created, you could do this with a ToolTip.
In the example created in Chapter 6, you now want to inform the end user about a formula. The text should appear whenever a user mouses over the Days Until Shipped fields on the report. The following steps create a ToolTip:
- Open Chap6.rpt, or the report created earlier in Chapter 6. Select File, Open and browse to find Chap6.rpt and open it.
- Format the e-mail field at the far right. Right-click on it and choose Format Field.
- Add the ToolTip text. In the Format Editor dialog, select the Common tab. To the right of the ToolTip Text box, click on the formula editor button (see Figure 9.2), and enter the following formula, which makes a custom message for each e-mail address:
"Click here to compose an e-mail to " + {Customer.Contact First Name} + " " + {Customer.Contact Last Name} + "."
Figure 9.2. On the Common tab, click the ToolTip text formula button.
- Test the ToolTip text. Click OK to finish the formatting. In Preview, scroll the mouse over the e-mail field and see that the rollover text now appears as a custom message, which is different when viewed by each e-mail recipient. Before proceeding, save the report as Chap9_1.rpt by choosing File, Save As.
Lines and Boxes
Adding lines and boxes to a report can make it easier to read as well as visually grouping items for business users.
To add lines under each Detail section as well as a box around each group, follow these steps:
- View Chap9_1.rpt in Design mode. If the report is not already open, open it using Ctrl+O. Make sure that the report is in Design Mode by choosing Ctrl+D.
- Insert the line by Choosing Insert, Line. The mouse changes to a pencil. Move the mouse to the bottom-left of the fields in the Details Section. Hold down the left mouse button to begin drawing the line. Scroll the mouse to the right until you reach the end of the Details Section. Once reached, release the mouse button.
- View the result in Preview mode. Select F5 to refresh the report to see the line with the data as shown in Figure 9.3.
Figure 9.3. Use the Preview mode view of a report to show a line under each detail record.
- Add the box by choosing Insert, Box. The mouse changes to a pencil. Move the mouse to the top-left of the Country/Pays USA data in the Group Header. Hold down the left mouse button to begin drawing the box. Scroll the mouse down to the bottom left of the Summary amount in the Group Footer and then scroll to the right until the end of the Group Footer section. Once reached, release the mouse button. The resulting box should appear similar to Figure 9.4.
Figure 9.4. Preview a report to show lines and boxes.
- Choose File, Save As and save the report as Chap9_2.rpt.
TIP
A feature of boxes is that they can be rounded. To do this right-click on a box, choose Format Box, and select the Rounding tab. The rounding factor can be changed by the slide or the percentage buttons. Figure 9.5 shows how Xtreme's report would look with a rounded box at 30%.
Figure 9.5. Preview of a report showing rounded boxes.
Creating a Vertical Text Watermark
Another visually pleasing feature is the capability to rotate text. This can be very effective when used in conjunction with the Underlay Section property for sections. Follow these steps to make a sample watermark:
- Start by using Chap9_2.rpt in Design mode. Choose Insert, Text Object to add a text field in the Report Header. Enter DRAFT for the text.
- Right-click on the Text field and choose Format Text. Select the Common tab. Change the Text Rotation to 90 degrees and click OK. Go to the Font tab, where you can change the font size to 48pts. Because you want this watermark to be semi-transparent, choose the More item from the Color drop-down, where you can specify a custom color. Choose a light gray (or silver). Increase the Character font spacing by specifying 70 pts in the dialog, then exit the dialog by clicking OK twice.
NOTE
This color section, common to all objects within Crystal Reports 10, enables you to specify colors using RGB or Hue, Saturation, and Luminance. By choosing corporate colors and adding them to the custom colors, you can extend corporate branding into report presentation.
- Resize the field. Because the field needs to go down the page, it needs to be resized to be narrow and long. Select the field and choose the rightmost square on the field. Resize the object by holding down the left mouse button. Now choose the bottom square on the field and stretch the height to 5''. Figure 9.6 shows how this should look.
Figure 9.6. Design tab with text rotation applied to group name field.
- Refresh the report to see your progress by pressing F5. It shows the text rotated, although it is not running down beside the records as shown in Figure 9.7.
Figure 9.7. Preview of the report with text rotation.
- Set the Report Header to Underlay. Because the text does not yet flow to the record level, it must be underlayed. This is a section property. Right-click in the Group Header 1 section located on the left side of the report design area, choose Section Expert, select Underlay Following Sections, and click OK. The desired results should appear similar to Figure 9.8.
Figure 9.8. Preview of the report with rotated text flowing beside detail records.
CAUTION
Realize that when rotating text, the justification rules might be opposite of what would normally be expected. In the case of 90 degrees, the text must be right-justified to have the company name appear to be top-justified, as shown in Figure 9.8.
- Save as Chap9_3.rpt.
Категории