Tuesday, January 8, 2013

Design considerations in Crystal Reports

Listed below are several design hints for creating reports that will be shared with other people.

Correctly spacing text objects

Ensure each field object is a little bit larger than the maximum value it will displayed. This will avoid values being truncated.

Placing text objects close to other objects

As previously discussed, a text object’s boundary will not expand at runtime. If the printer driver being used prints fonts wider, the text could be truncated. A solution is to expand the width of the text-based object to accommodate this possible growth. While this is an effective solution, it does require some design considerations when placing text-based objects close to other objects.

Consider the following example:

A second object is placed to the immediate right of a text object. In order to accommodate possible growth, the text object on the left is expanded so that its expanded boundary is now overlapping the boundary of the second object. The report is printed and everything looks correct. It is then printed using another printer driver that causes the text to print wider. Although the first object’s boundary was made wider to accommodate the variance in text width, the two objects’ physical starting points (their X coordinates) do not change. Thus, a situation could exist where the text from the object on the left could print over top of the second object on the right. The same situation could exist when creating a columnar type report, where lines separate the columns. In this situation, the text could potentially print on top of, and outside of, the lines.

It is generally advisable to avoid designing distributed reports where the space between objects is very tight. Leave room for expandability and expand the text objects’ width by approximately 5%. An alternative is to consider reducing the size of the font.

Placing multi-line text objects

Consider where and how you place multi-line text-based objects. You could encounter problems if you have other objects in the same section placed directly below an object formatted to print on multiple lines. For example, on the development PC, a multi-line text-based object is placed on the first line of a section. Since the text object normally never requires more than three lines to print, the developer places another object on line four of the section. Since a different printer driver could measure the font wider and cause the multi-line object to require an additional line, the object on the fourth line is now in danger of being over printed with the last line of the multi-line text object.

So, wherever possible, place multi-line text-based objects at the bottom of the section. If they require more lines to print, the section will simply expand to accommodate the growth.

Using TrueType fonts

Designing your report using printer-specific fonts may lead to problems when printing to other printers. The fonts may not be supported by other printers. If they are supported, they may not be installed on other printers. If this occurs, Crystal Reports will have to make a font substitution that could create inconsistent results. It is recommended that only common TrueType fonts be used. Common True Type fonts include Arial and Times New Roman.

Using the most common video resolution

If you have two identical printers, two identical printer drivers and two identical operating systems but the resolution of the video driver is different, the paging of Windows documents will be different. It is recommended that you set your video resolution to the most common video resolution. If a document is designed with the video set to a resolution of 1024 X 780 pixels and is then printed on another PC where the video resolution is coarser (such as 800 X 600 pixels), the document will encounter more formatting changes than if it was developed on 800 X 600 and moved to a finer screen resolution. Developing reports with your video resolution set at the most common and coarsest resolution will ensure that your reports will be the least sensitive to video driver settings. Unfortunately, there is no way to design Windows documents to be immune to changing video driver resolutions.

Setting specific margins

Crystal Reports has the option of setting specific margins or using the printer’s default margins. If you use the default margins and then print in another environment where the printer’s default margins are greater and provide a smaller printable area, the report objects on the right size of the report will print off the page and will be truncated. It is recommended that you always set your own margins. As soon as you do so, the check box to Use Default Margins (click Page Setup from the File menu) will be cleared. If the margins you want to use are the same as your default margins, make sure that you clear this check box:

1. On the File menu, select Page Setup.

2. Clear the Use Default Margins check box. Click OK.

Changing the paper orientation

To change the default printing option from portrait to landscape:

In Crystal Reports XI Release 1 and Release 2:

Select Page Setup from the File menu. From the Page Setup dialog box select Landscape.

In Crystal Reports 10 and lower:

Select Printer Setup from the File menu. From the Printer Setup dialog box select Landscape.

Note that this option will only appear if the printer is capable of printing in both portrait and landscape modes. Changing the default printing option from portrait to landscape will not change the default margins or user defined margins used by the printer. The option will change only for the particular report.

Choosing the default printer (Crystal Reports 10 and lower)

In general, it is recommended that you do not choose a specific printer. While doing so will not impair Crystal Reports, it might result in complications due to the many different ways that printers are recognized on different versions of Windows.

For example, suppose an HP Laser III printer is installed on three different operating systems.

• With Windows 95, the printer name can be changed so that HP Laser III is now “Front Reception Printer”; however, the printer driver will be listed as Hppc15ms.drv.

• With Windows NT, the printer name is also referenced and can be changed by the user but the printer driver is always winspool.

• If you specify a specific printer, Crystal Reports will be looking for that printer by name. If the specific printer you specify does not exist, the default printer will be chosen. If you need to specify a specific printer, such as a label printer or a printer dedicated to printing invoices, the printer name must be the same as the machine the report was designed on. If your report is part of a distributed application, you can:

• Provide your users with a Select Printer dialog box so that they can choose the correct printer, or;

• Give the specific printer on the development machine the same name, as it would have on other computers – that is, the name of the actual printer chosen.

Continuing with the above example, you would name the printer “HP Laser III”. In this way, all clients using the same specific printer in Windows 3.X environments will be named the same (HP Laser III) and the specific printer will print the report.

For Windows clients, simply rename the printer (“Front Reception Printer”) back to “HP Laser III” or set up an identical printer with the correct default name.

If you must use a specific printer with a specific name, be aware that all your clients must have the same printer or they could encounter problems.

Maintaining default printer settings (Crystal Reports 10 and lower)

If the Default Properties option is selected it allows the default printer properties to be used as it is set in the Windows Control Panel. To select the Default Properties in Crystal Reports, complete the following:

1. From the File menu, select Printer Setup.

2. Select Default Properties from the Print Setup dialog box.

Making modifications to the properties in the printer setup dialog box will cause the default properties option to become cleared.

Selecting Free Form Placement for all sections

In order to create dynamic reports and reduce printer driver dependency as much as possible, it is recommended that all sections of the reports be formatted with Free Form Placement selected (in Crystal Reports XI Release 2 this isn’t an option anymore, it is always in Free Form Placement).

No comments:
Write comments
Recommended Posts × +