Six quick Crystal Reports design tips

Source: Internet
Author: User



I have found myself working on projects where reports have been last minute additions that demanded a great deal of time and a certain touch of detail. when times, reports are cobbled together, with good design and performance falling to the wayside. reports are the primary representation of the data on your system; after putting so much hard work into the application that is collecting data it is important to put a little extra effort forth to design truly "killer" reports for your application.

The development tips in this article are primarily intended for developers without much experience with Crystal Reports. This article assumes the reader has a basic knodge DGE of Crystal Reports data access.

We will cover six quick tips that will enable you to quickly create reports that are richly featured. we will start with a basic report that a manager of a project may ask for; order fulfillment. the following examples will be created from the SQL Server 2000 northwinds Trading Company sample database. the sample report referenced throughout this article pulls data from the orders, MERS MERs, and products tables. the report is intended to be a representation of a typical order fulfillment report. it groups orders together, and displays information about each product under the order. the examples below are using Crystal Reports 2008, but have also been tested with Crystal Reports XI.

Using templates
[Back to Top]

Using templates helps with one of the most important aspects of delivering quality products, being consistent. crystal Reports 2008 ships with twelve built in templates, but the power comes from the ability to create your own templates.

Report templates are existing crystal report (. rpt) files which will allow you to "inherit" custom design related formatting settings including:

·Page headers and footers

·Color formatting

·Charting settings

·Lines, borders and boxes

·Logos and Images

·Addition of Standard Functions

·Addition of special fields

·Field highlighting

Figure 1: a report that does not have a template applied

To apply a template, select the "template expert" found on the report menu.

Figure 2: Crystal Reports template expert


To apply a custom template, select "Browse" on the template expert and navigate to an existing report you wowould like to use as a template for your new report. in our example we will use the "northwindtemplate. RPT "file.

Figure 3: a report with a custom template applied

The northwind template report file contained header information with company detail and a logo that our new report has now inherited.

Copying with formatting between fields
[Back to Top]

This tip may be one that reads readers are already aware of, but it is still worth mentioning. formatting Objects on a report can be a tedious task, when there may be multiple formatting options applied to each object on your report. including labels, the formatting may need to be applied to over a hundred objects on a report, which increases the possibility of errors. to help minimize errors, use the "format painter" tool.

Figure 4: Format painter Tool

To use the "format painter" tool, follow the following steps:

1. Select an object from which to copy formatting.

2. Select the "format painter" tool from the menu.

3. The cursor will change to a paint brush; use it to select the object from which you wowould like to copy the formatting.

4. Double click the "format painter" tool from the menu.

5. Click on any other object to apply the formatting to that object.

Now the formatting from the original object you selected will be applied to each of the objects you select. To turn off the "format painter" tool, click on the tool again in the menu.

Evaluating Performance
[Back to Top]

It is important to monitor performance from the start of development when you are creating Crystal Reports. this will save time later in the development cycle trying to figure out why a report is slow. code profiling is the amount of time that various behaviors of your application take to run. you shoshould be running a profiler on your SQL statements before the data even gets to the report, to be aware of how long your queries take to run.

Crystal Reports provides a tool to estimate how long the report will take to load (render time ). in my opinion if you are working with data and you're not profiling your code then you're not doing your job.

The Crystal Reports performance information tool can be found on the report menu.

Figure 5: performance times for the Order Fulfillment report

So, what is an acceptable load time? It depends. load times of not more than six seconds are a good goal, but there are always provided tions. keep reports as simple as possible, and query only the data needed for the report. use SQL to perform as your functions as possible before the data is passed to the report, such as ordering, or in some cases grouping data. if you see a section of data that can be broken out of into a new report, doing so may help with load times.

Highlighting data
[Back to Top]

often times the style of certain types of items needs to be changed to make them stand out on the report. this is commonly used to indicate negative numbers, or numbers over or under a certain threshold. crystal Reports has built in support for this that makes this easy to accomplish.

in this example, the formatting of the "units in stock" objects needs to be changed when the value is less than 15. to accomplish this, first select the field by clicking on it once. select "highlighting expert" from the Format menu; then select "new ".

Figure 6: the highlighting expert

you will be able to set options for when and how the highlighting will occur. for this example, I set the font color to red and the background to yellow, when the "Units in stock" object is below 15.

Figure 7: highlighting when units in stock is below 15

Showing a check box on a report
[Back to Top]

One of the most important things I have learned with Crystal Reports is that popular times you need to "think outside of the box". Crystal has support for boolean operators to be displayed as the following:

True or false

T or F

Yes or no

Y or N

1 or 0

Crystal Reports does not have built in support to display a check box for boolean operators, but with a little creatiors and the wing ding font, this task can be easily accomplished. the following example will have strate how to use check boxes to replace true/false statements in the "discontinued" field. the simplest way to accomplish this task is to change the display string of the value, and then set the font of the object to wing ding. first a formula will need to be added to change the display text of the field. right click on the Boolean field you wowould like to change, and select "format expert ". on the common tab, click the X + Y button for the "display string" option.

Figure 8: Format editor display string

Ensure that "crystal syntax" is selected and copy the following formula:

Figure 9: Changing the display string

The character code 0xfe in the wing ding font represents a box with check mark. in contrast, the character code 0xa8 represents an empty box. the Character Map tool, which can be found in the accessories folder in the Windows Start Menu, will assist you in discovering the hex values for character codes of the items you wocould like to display. after you have found the character code for the value you wowould like to display, add it to your formula. it is much simpler to use the decimal representation of the ASCII value instead of the hex value. this is a great site find all of the ASCII values, including their hex and decimal representations. after you have set your formula, make sure you set the font for the object to wing ding, on the "format Editor" screen.

Figure 10: The Windows Character Map Tool

Figure 11: Fulfillment report with discontinued check boxes

Tool tips
[Back to Top]

Objects on a crystal report allow for the addition of a tool tip. what's great about features like this in Crystal Reports is the ability to apply formulas. this example will explain strate how to add a tool tip to the "Units in stock" field that will indicate how many units are on order when the user hovers over the object. the tool tip will generate this data from a formula.

To add a tool tip to a report object, right click your object and select "format Editor ". select the common tab and click on the X + z button next to the tool tip text box.

Ensure crystal syntax is selected, and enter the following for the formula:

Figure 12: Tool tips for units on order

Figure 13: The tool tip over the units in stock Field

Text watermark
[Back to Top]

A common report request is the ability to add a watermark to a report indicating that it is a draft. this example will show you how to accomplish this. in order to create the watermark, create a new header section, add a Text object for the watermark and select the "underlay following sections" option. this allows for new header to be abve the rest of the sections of the report.

Figure 14: The section expert

Figure 15: the watermark in the designer

The text object that was added has a silver 72 point font set, font spacing of 80 and the text turned 90 degrees. The text rotation option is found off the common tab in the section expert.

Figure 16: Fulfillment report with draft watermark

Don't forget that you can suppress sections in Crystal Reports via code if you wowould like to provide an option to print the report without the watermark. suppressing sections through code is out of scope of this document.


The six tips in this article are just the tip of the iceberg when it comes to developing Crystal Reports. the tools available within Crystal Reports make it easy to design professional, scalable reports for those without a fine art degree or advanced-level knowledge.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.