1. Trang chủ
  2. » Công Nghệ Thông Tin

Crystal Reports 9 The Complete Reference PHẦN 4 potx

89 396 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 89
Dung lượng 2,54 MB

Nội dung

You can also create string formulas that provide roughly the same functionality as these examples and place them in appropriate report sections. However, to minimize potential “formula clutter,” it sometimes may be preferable to just create text objects and conditionally suppress them. Special Fonts, Graphics, and Line Drawing As mentioned at the beginning of the chapter, Crystal Reports is a true Windows report writer. This means that it can use most of the fonts and graphical capabilities of Windows. Using Special Fonts Don’t hesitate to use symbol fonts that are installed on your computer. In particular, the Symbol and Wingdings symbol fonts are included as part of Windows and should be available to most “target” systems that will be running your report. Don’t forget that any fonts you use when designing your reports must also be present on the machine that runs your reports if you expect the report to look identical on both machines. Using Times Roman, Arial, Symbol, and Wingdings fonts, at a minimum, is pretty safe, because they are installed by default on all Windows systems. Both Symbol and Wingdings fonts contain typographical symbols instead of letters and numbers. Although you type letters and numbers into a text object or formula formatted with a text font initially, you’ll see them replaced with the symbol characters once you change the font from a text font to one of the symbol fonts. You’ll need either a font table (typically available from Windows Control Panel) or a little extra time to experiment and figure out what symbols display when you type certain letters, numbers, or special characters. Figure 9-3 shows a report using the Wingdings font. In this example, the following formula is being displayed on the report next to the order amount, formatted using the Wingdings font: If {Orders.Order Amount} < 1000 Then "L" Else If {Orders.Order Amount} > 1000 And {Orders.Order Amount} < 2500 Then "K" Else "J" 238 Crystal Reports 9: The Complete Reference Using Bitmap Graphics If you are planning to create reports that approach the quality of output from page publishing programs, you’ll soon have a need to use bitmap graphics in your reports. Bitmap graphics are common graphics files most often associated with the Web (such as .JPG files) or Windows paint program files (such as .BMP and .PCX, and .WMF files). You may have a company logo that you want included on the title page of the report. Or, you may want to add a smaller graphical element, such as an icon, to another section of the report. To insert a bitmap graphic, first make sure you are displaying the Design tab. Although it’s possible to add a graphic while viewing the Preview tab, this is risky, because you won’t always be sure which report section the graphic will end up in. Click the Insert Picture button on the Insert Tools toolbar, or choose Insert | Picture from the pull-down menus. A familiar File Open dialog box will appear, asking you to choose a bitmap format file. Navigate to the necessary drive and folder, and the dialog box will show Chapter 9: Making Your Reports Visually Appealing 239 CRYSTAL REPORTS 9 INTRODUCED Figure 9-3. Report using symbols as well as text any files at that location that can be added to the report. Choose the correct file and click OK. An outline will appear alongside your mouse cursor. Drag the outline to the section of the report where you want the graphic to be placed, and click the left mouse button to drop it there. If the graphic happens to cover more than one report section, it will be dropped in the section where the upper-left corner of the outline is when the mouse is clicked. Once you drop the graphic, you’ll see it appear in the Design tab. You have complete control over how the graphic is sized and cropped. You can simply drag the graphic to a new location on the report, or resize it using the sizing handles on the sides and corners. You can also position the graphic (or any other object on the report, for that matter) with the Object Size and Position dialog box. Select the object that you want to position, right-click, and choose Size and Position from the pop-up menu. You can also choose Format | Size and Position from the pull-down menus. To format the graphic more precisely, you can use the Format Editor. Make sure the graphic is still selected. Then, click the Format button in the Expert Tools toolbar, right-click the graphic, and choose Format Graphic from the pop-up menu; or choose Format | Format Graphic from the pull-down menus. The Picture tab allows you to specify exact cropping and scaling specifications. 240 Crystal Reports 9: The Complete Reference Only common bitmap graphic formats are supported in Crystal Reports. It will not recognize specialized formats, such as Adobe Photoshop, or vector formats (other than Windows Metafile), such as those from CorelDRAW or Adobe Illustrator. If you wish to use these graphics in a report, you need to convert them to common bitmap formats with another program before adding them to your report. And if you wish to include graphics from Web pages, you must use .JPG format—Crystal Reports won’t recognize .GIF files. Although using symbol fonts, such as Wingdings, is very powerful, you are limited to what is included in the font itself. Also, the symbols are generally simple two-dimensional images and can be displayed only in a single color. Wouldn’t it be nice if you could use smaller bitmap files, such as icon-like graphics that look more three-dimensional and include several colors, on your report? Because you can suppress bitmap files conditionally, just like other objects, you have real power and flexibility in creating visually appealing and interesting reports using bitmap graphics. Figure 9-4 shows a report with unique icons indicating the status of an order. Orders that have been shipped (or are “closed”) have a closed file folder next to them. Open orders (not shipped) have an open file folder next to them. CRYSTAL REPORTS 9 INTRODUCED Chapter 9: Making Your Reports Visually Appealing 241 Figure 9-4. Using bitmap files formatted conditionally TEAMFLY Team-Fly ® 242 Crystal Reports 9: The Complete Reference This report uses a technique that could be called mutually exclusive suppression. There are two different bitmap files on the report: an open-file bitmap and a closed-file bitmap. They are placed right on top of each other in the details section. They are conditionally suppressed in such a way that only one will ever be displayed at a time. In this case, they are suppressed using the Shipped field (a Boolean field that returns true or false) from the XTRME Sample Database Orders table. The open-file bitmap is conditionally suppressed using this formula: {Orders.Shipped} while the closed-file bitmap is conditionally suppressed using this formula: Not {Orders.Shipped} Because of this, only one bitmap will ever be visible at a time. The success of this technique depends on Crystal Reports allowing multiple objects to be placed right on top of each other. You have the ability to do this with any text or graphic object whenever and wherever you choose. Just make sure you implement some technique similar to this to prevent them from splattering all over each other. You can also use the Move to Back, Move Backward, Move Forward, and Move to Front options from the Format pull-down menu or from the pop-up menu that appears when you right-click an object. These options determine which objects have “priority” when they are placed on top of each other. Line and Box Drawing You can use the Border tab on the Format Editor to control lines on all four sides of individual objects. While this lets the individual objects stand out by having lines or boxes appear around them, you may want more flexibility to have groups of objects highlighted with boxes or to have lines stretch partially or completely across sections. Crystal Reports lets you use line and box drawing tools to create these boxes and lines. To create a line or box, ensure that you have the Design tab chosen. Inserting lines or boxes in the Preview tab may give you undesirable results if you don’t put them in the right section. To add a line or box to your report, perform these steps: 1. Click the Insert Line or Insert Box button in the Insert Tools toolbar. You can also choose Insert | Line or Insert | Box from the pull-down menus. 2. When you make either of these choices, your mouse cursor changes to a pencil. Point the pencil to where you want to begin the line or box and hold down the left mouse button. 3. Drag the line or box to its ending position and release the button. Notice that you can draw only perfectly vertical or horizontal lines—diagonal lines can’t be drawn. The line or box will appear on the report, complete with sizing handles. You can now drag or resize the line or box just like any other object. You may also format the line or box with the Format Editor (using options from the Format pull-down menu, or by right-clicking the line or box and choosing Format from the pop-up menu). You can choose the color, size, and style of the line or box, along with other options (Crystal Reports allows you to create rounded boxes, for example). Figure 9-5 shows a report that uses a horizontal line to delineate group footers, and places a filled, rounded box around report totals. You can draw lines and boxes that traverse multiple report sections. This is handy if you want to have a single box enclose a column starting in the page header and ending in the page footer, including all the sections in between. However, this can sometimes result in odd behavior if, for example, you start a line in the page header but end it in the details section or a group footer. If your lines or boxes traverse sections, make sure you preview the report to check that you get the desired results. Chapter 9: Making Your Reports Visually Appealing 243 CRYSTAL REPORTS 9 INTRODUCED Figure 9-5. Line and box drawing Text and Paragraph Formatting Crystal Reports includes various text formatting features that enhance reporting capabilities. Some are designed for use with foreign-language versions of the report writer (such as Japanese), while others simply provide enhanced functionality for more reporting situations. A subtle feature that may not be immediately noticeable is fractional point sizes for fonts. If you use the Point Size drop-down list either in the Format toolbar or from the Font tab of the Format Editor, you’ll see that only whole-number point-size values are available. However, if you click inside the drop-down list, you can then type values directly into the drop-down list, rather than choosing predefined numbers. If you want to use a 10.5 point size instead of a whole number, simply type 10.5 and press ENTER. You may type in sizes in ½-point increments (10.5 will work, but 10.25 will round to 10.5). You’ll also notice a Text Rotation option on the Format Editor Common tab. This allows you to rotate objects based on TrueType or built-in printer fonts to 90 degrees (sideways from bottom to top) or 270 degrees (sideways from top to bottom). Just choose the desired rotation from the drop-down list. You’ll probably need to adjust the height and width of the now-rotated text to properly show all the material in the object. You can make innovative use of text rotation by using multiple report sections and the Underlay section formatting option, described in Chapter 10. For example, by placing a rotated text object in Page Header b (which is formatted with the Underlay option), you can have vertical text flow down alongside the rest of your report on every page. This technique can be helpful for replicating special forms, for example. Format Editor Paragraph Formatting Tab If you format a string or memo database field or a text object, Crystal Reports presents an additional Paragraph tab on the Format Editor, as shown in Figure 9-6. Use these options to determine how multiple lines of text or data will be formatted: 244 Crystal Reports 9: The Complete Reference ■ Indentation—First Line Indicates the amount of space the first line in each paragraph will be indented. The first line of the text or any line after a carriage return is considered the first line of a paragraph. ■ Indentation—Left Indicates the amount of space that the entire field will be indented from the left side of the object. ■ Indentation—Right Indicates the amount of space that the entire field will be indented from the right side of the object. ■ Spacing—Line Spacing Adds vertical blank space between each line in the paragraph. Choose the Multiple option to choose a multiple of the normal spacing (for example, two times normal spacing). Choose the Exact option to choose a specific point size for line spacing (for example, 5 points). Chapter 9: Making Your Reports Visually Appealing 245 CRYSTAL REPORTS 9 INTRODUCED Figure 9-6. Paragraph Formatting tab on Format Editor 246 Crystal Reports 9: The Complete Reference ■ Spacing—Of x Times Normal Specifies the associated number for the Multiple or Exact Line Spacing option. ■ Reading Order Specifies whether the text in the object that’s being formatted will be read from left to right, or right to left. This option generally applies to non-English versions of Crystal Reports, and while it doesn’t reverse the display of characters that make up a field, it does rearrange placement of punctuation marks that appear at the end of fields. Using HTML and RTF Text Interpretation Figure 9-6 also shows the Text Interpretation drop-down list on the Paragraph Formatting tab (you’ll see this option only with string or memo database fields—not with text objects). Available options in this drop-down list are None (the default), HTML Text (Hypertext Markup Language), and RTF Text (Rich Text Format). HTML text is often associated with the Web—Web pages are encoded in HTML. RTF is a standard text format that is interchangeable between most popular word processors and page publishing programs. If you leave the default Text Interpretation option of None chosen, Crystal Reports simply displays the value from the database as it actually appears in the database. If the field contains special formatting codes, they’ll just appear on the report directly. If your database string or memo fields contain text with special HTML or RTF formatting codes to describe fonts, colors, and special formatting, choose the appropriate HTML or RTF Text Interpretation option. Crystal Reports will convert these formatting codes into actual typeface, point size, color, and formatting options. Notice how a Text Interpretation setting of None (as opposed to a setting of HTML) displays a database field that’s encoded using the Hypertext Markup Language. For a list of specific HTML tags that Crystal Reports interprets, search online help for “Paragraph Formatting tab.” Report Alerts In addition to some of the conditional reporting features discussed elsewhere in this chapter, Crystal Reports allows you to highlight records that meet a requirement using Report Alerts. Report Alerts enable you to set up a condition that Crystal Reports checks for every time you refresh the report (by clicking the Refresh button in the Standard toolbar, by selecting Report | Refresh Report Data from the pull-down menus, or by pressing the F5 key). Report Alerts can also be used to highlight desired conditions when reports are scheduled with the Crystal Enterprise Web-based reporting system (covered in Part II of this book). While you’ve always been able to conditionally format report sections and objects in terms of a condition, you might not have always known which customers, sales reps, months, and so forth had “triggered” this condition without going through the report page by page looking for the conditionally formatted sections. Now when a report with Report Alerts defined runs, a separate dialog box will pop up if any of the conditions on the report have been met. You can then click a button on the dialog box to display a separate tab (similar to a drill-down tab) that shows only report records that meet the alert condition. To work with Report Alerts, choose Report | Create Alerts from the pull-down menus. The Create Alerts dialog box will appear, as shown in Figure 9-7. If any existing alerts have already been created in the report, they’ll appear inside this dialog box. If you wish to modify any existing alert, select it in the dialog box and click the Edit button. Chapter 9: Making Your Reports Visually Appealing 247 CRYSTAL REPORTS 9 INTRODUCED Figure 9-7. The Create Alerts dialog box [...]... 248 Crystal Reports 9: The Complete Reference To delete an existing alert, select it and click the Delete button If there are no alerts in the report yet, the dialog box will be empty To create a new alert, click the New button The Create Alert dialog box will appear, as shown in Figure 9- 8 At a minimum, you must specify the name of the Report Alert in the Name text box, and the condition... page, because the report header will print and Crystal Reports will skip to the next page before printing CRYSTAL REPORTS 9 INTRODUCED Property 263 2 64 Crystal Reports 9: The Complete Reference the first group header Conversely, if you set New Page After on a group footer, you’ll often encounter a stranded last page, because the last group footer will be followed by a page break before the report footer... predefined templates in the Template Expert are supplied by existing RPT files By default, Crystal Reports looks in \Program Files \Crystal Decisions \Crystal Reports 9\ Templates for template reports If you wish to change the location that Crystal Reports uses to populate the Template Expert, you must change the Registry key HKEY_LOCAL_MACHINE/Software /Crystal Decisions /Crystal Reports/ Templates/TemplatePath... using the Section Expert The conditional formula would be similar to this: 251 252 Crystal Reports 9: The Complete Reference To apply a template from a report wizard, simply select one of the predefined templates in the Available Templates list When you choose one of the templates in the list, a thumbnail view of the template is shown in the Preview section of the Report Wizard You may also choose another... showing just the relevant records CRYSTAL REPORTS 9 INTRODUCED Once you’ve saved the alert, simply refresh the report If any order amounts in the report exceed $5,000, you’ll receive an alert dialog box indicating that the alert has been triggered 2 49 250 Crystal Reports 9: The Complete Reference You don’t have to just base Report Alerts on database fields, as in the previous example You can also base... s u a l l y A p p e a l i n g 2 54 Crystal Reports 9: The Complete Reference formatting However, as a general rule, Crystal Reports will compare report objects and report sections between the template and the current report, applying many of the formatting properties of both report sections and individual objects in the template to the current report If, for example, the template report contains two... re-preview the report, as shown here: 2 59 260 Crystal Reports 9: The Complete Reference This pop-up menu contains four additional features for resizing sections, as listed here: Insert Line Adds an additional horizontal guideline to the section ruler on the left side of the section If the section isn’t tall enough to show the additional guideline, the section grows taller Delete Last Line Removes the bottom... only during the current Crystal Reports session If you apply a template, save the report, and then exit Crystal Reports, you’ll be stuck with the template’s formatting when you next reopen the report Chapter 9: Add existing RPT file to the template list Figure 9- 9 Thumbnail view of selected template Redo previous template application Undo last template application The Template Expert The predefined... number by another but returns the remainder of the division operation, not the result of the division The RecordNumber built-in function simply counts records consecutively, starting at 1 Therefore, every other record CRYSTAL REPORTS 9 INTRODUCED follow across the page Now that many PC-based reports are printed by laser printers on plain paper, you must create your own “banded” reports if your reports would... 271 272 Crystal Reports 9: The Complete Reference Choosing whether to hide or suppress a section determines whether or not you want a report viewer to drill down into the section Also, note that the Suppress property can be conditionally set in the Section Expert, while the Hide property cannot Drill-Down Reports One of the most powerful features of an online reporting tool like Crystal Reports is interactive . Appealing 245 CRYSTAL REPORTS 9 INTRODUCED Figure 9- 6. Paragraph Formatting tab on Format Editor 246 Crystal Reports 9: The Complete Reference ■ Spacing—Of x Times Normal Specifies the associated. template, save the report, and then exit Crystal Reports, you’ll be stuck with the template’s formatting when you next reopen the report. 252 Crystal Reports 9: The Complete Reference The predefined. menus. The Picture tab allows you to specify exact cropping and scaling specifications. 240 Crystal Reports 9: The Complete Reference Only common bitmap graphic formats are supported in Crystal Reports.

Ngày đăng: 12/08/2014, 16:20

TỪ KHÓA LIÊN QUAN