Template Actions

book list add book to my bookshelf create a bookmark purchase this book online

mastering crystal reports 9
Chapter 13 - Report Templates
Mastering Crystal Reports 9
by Cate McCoy and Gord Maric
Sybex 2003

The Template Expert is used to apply, remove, and reapply templates to the currently open report. Open the expert by choosing Report > Template Expert, which opens the Template Expert dialog shown in Figure 13.8.

click to expand
Figure 13.8. Template Expert

Applying a Template

You can apply a template to a report as the report is being created using the Standard Report Creation Wizard. You can also apply a template at any point after the report has been created. If you choose to use the wizard approach, applying a template is the last step in the wizard; it follows choosing a data source, selecting fields, and setting group options. Figure 13.9 displays the screen that you’ll see when using the wizard. Notice the icon at the top right corner of the dialog. This icon appears on the toolbar in Crystal Reports so that you can choose or change the template during report design.

click to expand
Figure 13.9. Standard Report Creation Wizard—Optionally Applying A Template

Note 

Notice that the custom template created as an .rpt file and stored directly in the template directory appears in the list just above Confidential Underlay. This value displays in the list as a result of the report title field in the document’s properties.

As in other steps in the wizard process, the Template Expert icon is displayed in the top-right corner. This icon is available on the toolbar at any time from within a report once you’re inside the design environment.

Crystal ships with several built-in template styles that can be applied to your report. At the top of the list is the No Template option, which means that no special formatting has been added to your report. If the template you want to use is not in the list, you can find it using the Browse button. Clicking the Browse button displays the standard File Open dialog for locating a file on your computer or a network-attached computer.

When a template is applied, the fields in the report are matched up positionally, top to bottom, left to right, to the template fields. The formatting from the matching position field in the template is applied to the report field for as many field positions as are available and match positionally.

Note 

If a report contains more fields than are accounted for in the template, all extra fields are placed in a secondary Details section, for example, Details B.

The design elements in a template are applied to the report you’re building and will override any settings that are in conflict.

You can also apply multiple templates to a single RPT file providing that the objects within the template do not collide with one another.

Removing a Template

You can tell that a template has been applied to a report by opening the Template Expert and observing the radio buttons. If the Apply A New Template radio button is marked and both radio buttons below the Browse button are grayed out (Undo The Current template and Re-apply The Last Template), no template has been applied to this report.

If a template has been applied, you can remove it from a report by using the Template Expert and selecting the Undo The Current Template radio button. This is visible in Figure 13.10.

Reapplying a Template

In Figure 13.10, the Re-apply The Last Template option is visible below the Undo The Current Template option. Since the template is an RPT file, you might have occasion to change the template itself. For example, if the company logo changes or you want to add additional fields to the template, you can make the changes to the template RPT file, save them, and then come back to your report and select the Re-apply The Last Template radio button.

Changes to a template are not automatically reflected in the reports that use them. Instead, you have to actively choose to reapply the modified template. This approach to template modifications prevents older reports from being inadvertently updated.

Tip 

Refresh your report’s data after making any change to template field formulas.

click to expand
Figure 13.10. Removing a template

Use of content on this site is expressly subject to the restrictions set forth in the Membership Agreement
 
Conello © 2000-2003     Feedback


Mastering Crystal Reports 9
Mastering Crystal Reports 9
ISBN: 0782141730
EAN: 2147483647
Year: 2005
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net