Reports

# Chapter 8. Refining the Look

This chapter shows how to improve your report's appearance by:

## Setting Page Format

Figure 8-1 Specify page header and footer output through page format print nodes.

### Page Format Properties

A page format node has three properties:

Floating Footer
Specifies whether the page footer's position is fixed at the bottom of the page, or allowed to float directly below the output of each page.

Orientation
Sets the report's page orientation to portrait or landscape. If you set this property to Default, Panther uses the orientation that is set in the report invocation string (via the supplied option), the Page Setup dialog (on the Report menu), or (on Windows) by the print driver.

Page Size
Specify the dimensions of the output area on report pages. If these properties are left blank, Panther uses the page size that is set in the report invocation string (via the supplied option) or in the Page Setup dialog. You can select one of the predefined page sizes from the drop-down list, or specify your own page size in this format:
width x height [unit-spec]

Units of measurement (unit-spec) can be specified in inches (in), millimeters (mm), or characters (c—the default). If you specify dimensions in character (c) units, Panther uses the average character size in the report's default font to calculate a character unit's width and height.

### Displaying Page Numbers

To display page numbers in a report:

1. Create a dynamic output widget in the desired layout area—typically, an area that is output as the page header or footer.
2. Set this widget's Value property to Page Number.

For example, Figure 8-2 shows the structure of a report with a single group node; the report restarts page numbering for each iteration of that group. The group's header section contains a call node whose function init_page initializes page number widget pagenum to 1. So, each time the report processes a break in this group, pagenum is reinitialized to 1; successive page breaks automatically increment pagenum's value until the next group break occurs.

Figure 8-2 Report that restarts page numbering on each group break.

## Controlling Pagination

You can override this behavior and control page breaks in several ways:

### Controlling Group Pagination

By default, Panther prints as many groups on a single page as space allows, and splits groups across pages. Group headers and footers are printed intact and with at least one detail row. You can override this behavior in several ways:

#### How to Keep Group Data Together on the Same Page

1. Give focus to the group node.
2. In the Properties window, set Keep on Page to Yes.

#### How to Start a Group on Its Own Page

1. Give focus to the group node that identifies the desired group.
2. In the Properties window, set One per Page to Yes.

## Generating Title and Trailer Pages

### How to Create a Title Page

1. In the layout window, create a layout area that contains the output required for the title page.
2. In the Report Structure window, attach an instance node to the report structure's page format node.
3. Below the instance node, attach a print node and specify the title page's layout area.
4. Below the print node, attach an end page node. This forces a page break between the title page and detail data.

Note: If you want the title page to omit the header and footer output of the report's main body, insert a new Page Format node immediately below the Report node; attach to it the instance node and the title page's print node.

### How to Create a Trailer Page

1. In the layout window, create a layout area that contains the output required for the trailing page.
2. In the Report Structure window, create a page format node below the last page format node.
3. Below the new page format node, attach an instance node.
4. Below the instance node, attach an end page node. This forces a page break between the detail data and the trailing page.
5. Attach a print node to the instance node and specify the trailing page's layout area.

Figure 8-3 Report structure that specifies title and trailing pages.

## Using Fonts

You can format all widget output by applying different fonts and font sizes and setting one or more attributes—bold, italic, and underlined. Fonts can be chosen from these categories, listed in descending order of universality:

### Setting Fonts

You can set fonts at several levels in a report, listed below in order of precedence:

1. Individual widgets—Each output widget can have its own font settings. These override any defaults that are set at a higher level. The widget adjusts in size according to the font specification.
2. Layout area—The font properties set for the layout area are used by all widgets in that area that lack their own settings.
3. Report file—The font properties set for the report file are used by all layout areas that lack their own settings. To access report file font properties, give focus to the layout window and bring the Properties window into view.
4. Application—The applicable section in the configuration map file sets default printing font properties for all reports generated by this executable.

Note: Changing the font will change the grid size unless the grid height and grid width are set in the layout window's geometry property. If you change the font after setting the height and width, Panther will ask if you wish to rescale the grid to match the new font. If you say no, the grid will remain as you have specified. If not, the grid will adjust to the new font. When grid height and width are adjusted in this manner, the grid height and width are set to match the average height and width, respectively, for the newly selected font.

### Defining Printing Font Aliases

alias-name [ (font-qualifier...) ]    = font-spec	[ [ (font-qualifier...) ]    = font-spec ]...
Prolifics CourierProlifics Times RomanProlifics HelveticaProlifics Symbol
[Windows Fonts]# Prolifics Font Name   Qualifiers     Windows font# -------------------   ----------     ------------Prolifics Times Roman                = Times New Roman[PostScript Fonts]# Prolifics Font Name   Qualifiers      PostScript font# -------------------   ----------      ---------------Prolifics Times Roman   (italic bold) = Times-BoldItalic                        (italic)      = Times-Italic                        (bold)        = Times-Bold                                      = Times-Roman[PDF Fonts]#Prolifics Times Roman (italic bold)= c:\windows\Fonts\timesbi.ttf#                      (italic)     = c:\windows\Fonts\timesi.ttf#                      (bold)       = c:\windows\Fonts\timesbd.ttf#                                   = c:\windows\Fonts\times.ttf[Text Fonts]# Prolifics Font Name   Qualifiers         Text Font# -------------------   ----------         ---------Prolifics Times Roman   (24 italic bold) = Times_i_b_24                        (24 italic)      = Times_i_24                                         = Times[HTML Fonts]Prolifics Times Roman   = New Times Roman,Times

## Positioning Output

Ordinarily, the layout of a print node's output is determined by the position of the widgets within its layout area. A print node has two Composition properties, Justification and Indent, that generally override widget positions and determine where to place the print node's output at runtime.

Justification
Setting a print node's Justification property to Center, Left, or Right shifts all widgets in the print node's layout area as specified. Spacing between widgets remains unchanged. If set to Normal (the default), Panther uses each widget's Start Row and Start Column positions to output its data.

For example, Figure 8-4 shows layout area page_header, which is specified by the report header's print node. In the layout window, the first widget's position is flush left. You can center the actual header output by setting its print node's Justification property to Center:

Figure 8-4 To center the contents of a print node's layout area, set the print node's Justification property to Center.

Indent
Shifts right all widgets in the print node's layout by the amount of space specified. Spacing between widgets remains unchanged. Units of measurement (unit-spec) can be specified in inches (in), millimeters (mm), or characters (c—the default). If you specify dimensions in character (c) units, Panther uses the average character size in the report's default font to calculate a character unit's width.

## Reducing White Space

You can optimize use of the specified page dimensions in two ways:

### Shrinking Layout Areas

Sometimes, a layout area must anticipate variable amounts of data to output. This typically happens for two reasons:

#### Shrinking Out Empty Lines

proc check_cc_dataif cc_number == ""{  cc_label = ""}return

Figure 8-5 shows how this function is called through a call node that precedes the detail's print node:

Figure 8-5 Shrink out a line from the detail output by setting widgets on that line to an empty string.

#### Shrinking Arrays

To ensure that the report shows only the populated rows in this array and shrinks out the remaining elements, follow these guidelines:

Figure 8-6 Eliminate empty occurrences in an array by setting the print node's Shrink property to Yes.