To edit an existing query
7 Report Layout and Formatting
7.1 Using the report design environment .1 Understanding section characteristics.1 Understanding section characteristics
A report consists of several sections, including the Report Header, Page Header, Group Header, Body, Group Footer, Page Footer, and Report Footer.
For more information about sections, see Crystal Reports editor areas.
7.1.2 Creating multiple-column reports
Instead of having the data in the Body section of your report print straight down the page, you can set up multiple columns and have the data flow from column to column.
7.1.2.1 To create a multiple-column report
1. Open the report you want to format with multiple columns.
2. Right-click in the Body heading area and click Format Body.
The Format dialog box appears.
3. Select Multiple Columns.
4. Set the Column Width for your column.
Keep in mind the width of your paper when deciding your column width. For example, if you have three elements in your Body section, and they take up four inches of space, limit the width of the column to under four and a half inches so that all of the element information can be seen.
5. Choose a Flow Direction for your data.
6. If the report you're formatting contains grouping, select Multi-Column Groups.
7. Set the Horizontal and Vertical gaps you want to maintain between each record in your column.
When you preview the report, you will see that the data appears in columns. If your report has element headers, they appear only for the first column. To have element headers for the second column, insert a text element in the Crystal Reports editor.
7.1.3 Using smart guidelines
Smart guidelines help you format report columns in the Crystal Reports designer canvas. The columns and the objects within them can be moved and rearranged simultaneously as the smart guidelines calculate associated objects based upon similar alignment. The grids that appear on the report depend on the element you have selected and the feature automatically selects related elements in the column.
The smart guidelines feature can be turned off in the Report Options dialog box. If you want to deactivate the feature temporarily to resize a specific element, select the element and then press and hold the Alt key while resizing it.
Note
Smart guidelines do not work with elements that are already formatted, such as cross-tab elements.
7.1.3.1 To insert a column using smart guidelines
Smart guidelines allow you to insert new result object columns without having to manually move the surrounding columns over. If smart guidelines are disabled, the inserted result object will overlap the existing result object.
1. Select a result object from the Data Explorer side panel and drag the object to the report canvas.
2. Align the result object frame in the desired column until the smart guideline grids appear to indicate the column position and place the result object.
Note
If you insert a column between two existing columns, the blue smart guideline grid will change to a dark blue to indicate the column will be positioned between the existing columns.
7.1.3.2 Adjusting columns using smart guidelines
You can reorder, remove, and resize columns using the column side cursors and handles on the top of the report canvas. Smart guidelines allow you to delete and adjust columns without having to manually move the
surrounding columns over.
7.1.3.2.1 To adjust column width
1. Click the column you want to adjust.
Smart guideline grids appear.
2. Move the pointer over the right side of the column.
The cursor changes into a resizing cursor.
3. Click and drag the column width to decrease or increase the size.
7.1.3.2.2 To adjust column position
You can move a single column horizontally on the report canvas or multiple columns simultaneously.
1. Click a column you want to move.
Smart guideline grids appear.
2. Click the column handles on top of the report canvas and drag the column:
○ To move a single column, drag the column to the left or right. Smart guidelines will adjust the existing columns to accommodate the re-positioned column.
○ To move multiple columns, use a single column to push the existing columns over, or use the left side edge to drag a row of columns.
7.1.3.2.3 To swap columns using smart guidelines
1. Click the column you want to swap to select it.
Smart guideline grids appear.
2. Select the column handles on the top of the report canvas and drag the column to overlap the column you want to swap and click to place the column.
The column positions are swapped.
7.1.3.3 To create subcolumns using smart guidelines
You can create a subcolumn by using a spanning header element such as a box or text element that spans two or more columns.
1. Click a column you want to become a subcolumn.
Smart guideline grids appear.
2. Click Insert Box or Insert Text .
3. Place the element on the report canvas in the report or group header and drag the element frame to span two or more columns that you want to join.
The spanning header element becomes a single column containing subcolumns.
The subcolumns can be rearranged as a single column using the handles for the spanning header column.
7.1.4 Hiding report sections
Crystal Reports has several properties that you can set to hide or suppress report sections.
7.1.4.1 Show on Drill Only
The Show on Drill Only property hides a section whenever you run the report. For example, in a summary report, the Show on Drill Only property can be used to display only the summaries, but not the details behind the summaries. When the Show on Drill Only property is applied to a section, it becomes visible when the Drill-down cursor is used to drill down on the section contents. This property is absolute; it cannot be conditionally applied using a formula.
7.1.4.2 Hide
The Hide property also hides a section when you run the report. Unlike the Show on Drill Only property, however, you cannot apply the Hide property, then drill down to reveal the section contents. This property can be applied absolutely, or conditionally using a formula. This is useful for writing form letters. For example, in a form letter, you might create two Body sections: one to hide when sales are equal to or over $X and one to hide when sales are under $X.
7.1.5 Hiding report objects
Crystal Reports has several formatting properties for hiding individual objects.
7.1.5.1 Hide If Duplicated
The Hide If Duplicated property prevents an object value from printing if it is a duplicate of the value that comes immediately before it in the same section.
The value does not print, but the space in which it would have printed remains.
Note
This property does not work for text elements that contain embedded elements.
7.1.5.2 Hide the number when the value is zero
The Hide the number when the value is zero property prevents a value from printing if it is a zero value. The value does not print, but the space in which it would have printed remains. To remove the blank space, the section must have Hide If Blank set.
Note
This will only work if there are no other elements in the section.
7.1.5.3 Hide
The Hide property hides an object when you run the report. For example, it is common to apply this property to formulas that are needed to do some report calculations, but that you do not want to print when you run the report. When you select this property, the selected element does not print.
7.1.6 Keeping a section or element from breaking across pages
If a section or element does not fit in the remaining page space, then it is broken across two pages. To prevent this page break and have the entire section or element print on the next page, use the Avoid Page Break option.
Note
If a section or element is longer than one page, it prints across multiple pages even if you use the Avoid Page Break option.
7.1.6.1 To keep a section from breaking across pages
1. Right-click a section and click Format Section.
The Format dialog box appears.
2. Click Paging.
3. Select the Avoid Page Break check box and click Close.
4. Click Close.
7.1.6.2 To keep an element from breaking across pages
1. Right-click an element and click Format <<Element>>.
The Format dialog box appears.
2. Click General.
3. Select the Avoid Page Break check box and click Close.
7.1.7 Creating a section underlay
You may want to create a section underlay to add an image of a pre-printed form to a report, or to add a watermark to a report.
To create the underlay, you first add a picture or watermark to your report and then you reset the formatting so that the element underlays the report data.
7.1.7.1 To insert a picture onto the report
1. Click Insert Picture .
2. Select an image file, and then place it in the Page Header section, to the right of the objects in the report body.
Note
The picture is placed to the right of the objects to avoid underlaying the text. When you are working with a watermark (a subdued picture designed to be nearly invisible) place it directly above the text.
7.1.7.2 To make the picture underlay the following section
1. Right-click in the Page Header area of the report canvas and click Format Section.
2. Click Underlay Following Sections.
When you preview your report, you will see that the picture prints in both the first Group Header and the following few Body sections, next to (instead of above) the text in the body of the report.
Note
Using the technique of placing a picture to the right of the body of the report, you can set up a chart or an employee picture to print beside the details pertaining to that chart or employee.
3. In the Crystal Reports Structure mode, resize the picture vertically to make it two or three times larger, then preview the report again.
The image file now underlays more sections.
The area in which the picture underlays depends on the following conditions:
● The size of the picture.
● The section in which the picture was originally placed.
● The position of the picture in the section.
By modifying size and placement of an element, you can create a variety of visual effects using the underlay feature.
7.1.8 Using pre-printed forms
You can use the section underlay feature to create a Crystal Reports report that merges an image of a pre-printed form with your report data as a single, merged unit.
7.1.8.1 To create a report that includes a pre-printed form
1. Scan a form.
2. Place it in the report as a bitmap.
3. Use the underlay feature to line up the bitmap and report data.
7.1.9 Preventing the truncation of text inside an element
Whether you accept the default widths of text-based elements or you resize them, a problem could arise if the text inside the element prints right to the edge of the element frame. While the report may look fine on the machine it was designed on, when the report is printed using another printer driver that measures the font wider, the length of the text grows, but the element frame remains fixed. The resulting text is cut-off or truncated.
7.1.9.1 To prevent the truncation of text inside an element
1. Right-click the text element that you want to format and select Format Text.
The Format dialog box appears.
2. Click the General node.
3. Select Can Grow.
The element is now formatted to print on multiple lines. If the text prints wider than the element, the text wraps onto additional lines.
7.1.10 Hiding blank lines in embedded objects
Because you can embed objects in text elements, you might encounter cases where an empty object causes a blank line in a text element. You can hide blank instances of such embedded objects.
Note
Hiding embedded object blank lines is designed to remove blank lines within a text element if the text element contains an entirely blank object alone on a line.
7.1.10.1 To hide blank lines in embedded objects
1. In the Structure mode, right-click the desired text element and click Format Text.
The Format dialog box appears.
2. Select General and then select Hide Blank Lines Caused By Empty Objects.
Now, when the report prints, unwanted blank lines will no longer appear in place of empty embedded objects. You can confirm your changes in the Page mode.
7.1.11 Placing multi-line, text-based elements
While text-based elements that are formatted to print on multiple lines follow the same design rules as other elements, they have one additional characteristic to be considered. If the printer driver expands or contracts the spacing of the text, word wrapping may differ, changing the number of lines necessary to print the element in order to accommodate growth or shrinkage.
When placing multi-line text-based elements, you could encounter problems if other elements in the same section are placed directly below them.
Unlike single-line text-based elements, expanding the element frame of a multi-line text-based element to accommodate growth is not a viable option. When you do this, the line width increases according to the expanded boundaries.
So, when possible, place multi-line text-based elements at the bottom of a section. If they require more lines to print, the section expands downward to accommodate the growth, so that the expanded elements do not overwrite other elements.
7.1.12 Indenting lines
Using Crystal Reports, you can control line indentation for memo objects, string objects, and text elements.
Note
Only indentation values within the range of the object or text element width are accepted. An error message appears on the bottom of the view when you enter an incorrect value.
7.1.12.1 To indent lines for a data element
1. Right-click the element to be formatted and click Format Result Object Element.
The Format dialog box appears.
2. Select Paragraph.
3. Set your preferred indent options.
7.1.12.2 To indent lines for a text element
1. Right-click the text element to be formatted and click Format Text.
The Format dialog box appears.
2. Select Paragraph.
3. Set your preferred indent options.
7.1.13 Allowing for overflow object representation
Crystal Reports lets you use overflow object representation to assist users who are working with numeric or currency values in report cells. When the Allow Object Clipping option is not selected, numeric/currency object values that exceed the object size are represented by number signs (######) when you preview the report, letting you know immediately when the object is too small.
Otherwise, if a numeric or currency value is larger than the object containing it, that value is truncated, or
“clipped”. For example, values like 100,000,000 might appear on the report as 1,000, or as 000 (depending on the properties you have set). This could potentially cause confusion when the report is read.
7.1.13.1 To allow for overflow object representation
1. Right-click the currency object or number object that you want to format and click Format Result Object Element.
The Format dialog box appears.
2. Expand Format and then select Number.
3. Ensure that Allow Object Clipping is not selected.
7.1.14 Selecting multiple elements
You can select multiple elements, including text, object, chart, bitmap, and cross-tab elements, to format them together.
Once you have selected multiple elements, you can move, align, size, and delete them as a group. You can also change any common properties for these elements and have the changes apply to all elements.
Elements are moved, aligned, and sized based on a main element, which is the last element you select.
7.1.14.1 To select multiple elements
1. Click an element and Shift + click or Ctrl + click the other elements you want to select.
2. Right-click the main element and click Format Elements.
The Format dialog box appears.
3. Set your new formatting options.
7.1.15 Understanding text rotation
In the Format dialog box, you can use the text rotation properties to rotate text so that it reads vertically.
When you select a text rotation of 90 degrees, the text shifts 90 degrees in a counter-clockwise direction.
When you select a text rotation of 270 degrees, the text shifts 270 degrees in a counter-clockwise direction.
Note
If text rotation is left at 0 degrees, your text is oriented horizontally, left to right.
Note
Rotated text that spans over the edge of the page cannot be displayed as part of your report.
Note
Rotated text cannot be rendered by the DHTML viewers, so be sure to preview your report in the desired viewer before you deploy it.
7.1.15.1 To rotate text
1. Right-click the element that you want to rotate and click Format <<element>>.
<<element>> is the name of the element. For example, Format Result Object Element, Format Text, and so on.
The Format dialog box appears.
2. Select Font.
3. Change the Rotation to either 90 degrees or 270 degrees.
7.1.16 Modifying line spacing
With Crystal Reports, you can specify the amount of space between lines for memo objects, string objects, and text-based elements.
7.1.16.1 To modify line spacing
1. Right-click the object or element that you want to format and select Format <<element>>.
<<element>> is the name of the element. For example, Format Result Object Element, Format Text, and so on.
The Format dialog box appears.
2. Select Paragraph.
3. Enter a number for the Spacing value.
○ If you chose Multiple, the number you enter is multiplied by the font size of your text, and the program inserts the result as line spacing.
○ If you chose Exact, the number you enter is the exact number of points that the program inserts for line spacing.
7.1.17 Setting page size and page orientation
Crystal Reports allows you to view and print your reports in a variety of page sizes using either portrait or landscape orientation.
7.1.17.1 To set page size and page orientation
1. Click File Page Setup . The Page Setup dialog box appears.
2. Use the Paper Size menu to select a page size.
3. Use the Orientation options to set the page orientation.
4. Click OK.
7.1.18 Setting page margins
Crystal Reports allows you to change page margins to meet your specifications.
7.1.18.1 To set page margins
1. Click File Page Setup . The Page Setup dialog box appears.
2. Set the Margins to fit your needs.
3. Click OK.
Note
All margins are calculated from the paper edge. Thus, a left margin of .25 inches causes the printing to start exactly one quarter inch in from the edge of the paper.
Note
Select Adjust Margins Automatically if you want Crystal Reports to adjust the report's margins automatically the next time you change the page size. If you choose a new page size that is large enough for the current printable area, Crystal Reports increases or decreases the margins by enlarging or reducing the left/right and top/bottom margins by the same factor. If you choose a new page size that is smaller than the current printable area, Crystal Reports fills the entire page by reducing the margins to 0. If you next choose a bigger
Select Adjust Margins Automatically if you want Crystal Reports to adjust the report's margins automatically the next time you change the page size. If you choose a new page size that is large enough for the current printable area, Crystal Reports increases or decreases the margins by enlarging or reducing the left/right and top/bottom margins by the same factor. If you choose a new page size that is smaller than the current printable area, Crystal Reports fills the entire page by reducing the margins to 0. If you next choose a bigger