Defining print specifications for a DataWindow object

When you are satisfied with the look of the DataWindow object, you can define its print specifications.

To define print specifications for a DataWindow object

  1. In the DataWindow painter, select Properties from the DataWindow object's pop-up menu.

  2. In the Units box on the General page, select a unit of measure.

    It is easier to specify the margins when the unit of measure is inches or centimeters.

  3. Select the Print Specifications tab.

    The Print Specifications properties use the units of measure you specified on the General page.

  4. Specify print specifications for the current DataWindow object.

    See the following table for more information.

    Setting

    Description

    Document Name

    Specify a name to be used in the print queue to identify the report.

    Printer Name

    Specify the name of a printer to which this report should be sent. If this box is empty, the report is sent to the default system printer. If the specified printer cannot be found, the report is sent to the default system printer if the Can Use Default Printer check box is selected. If the specified printer cannot be found and the Can Use Default Printer check box is not selected, an error is returned.

    Margins

    Specify top, bottom, left, and right margins. You can also change margins in the Preview view while you are actually looking at data. If you change margins in the Preview view, the changes are reflected here on the Print Specifications page.

    Paper Orientation

    Choose one of the following:

    • Default: Uses the default printer setup.

    • Portrait: Prints the contents of the DataWindow object across the width of the paper.

    • Landscape: Prints the contents of the DataWindow object across the length of the paper.

    Paper Size

    Choose a paper size or leave blank to use the default.

    Paper Source

    Choose a paper source or leave blank to use the default.

    Prompt Before Printing

    Select to display the standard Print Setup dialog box each time users make a print request.

    Can Use Default Printer

    Clear this check box if a printer has been specified in the Printer Name box and you do not want the report to be sent to the default system printer if the specified printer cannot be found. This box is checked by default if a printer name is specified.

    Display Buttons - Print Preview

    Select to display Button controls in Print Preview. The default is to hide them.

    Display Buttons - Print

    Select to display Button controls when you print the report. The default is to hide them.

    Clip Text

    Select to clip static text to the dimensions of a text field when the text field has no visible border setting. The text is always clipped if the text field has visible borders.

    Override Print Job

    When you print a series of reports using the PrintOpen, PrintDataWindow, and PrintClose methods, all the reports in the print job use the layout, fonts, margins, and other print specifications defined for the computer. Select this check box to override the default print job settings and use the print settings defined for this report.

    Collate Copies

    Select to collate copies when printing. Collating increases print time because the print operation is repeated to produce collated sets.

    Print Preview Shows Outline

    Select to display a blue outline to show the location of the margins.

    Print Shows Background

    Whether the background settings of the DataWindow and controls are included when the DataWindow is printed.

    Preview Shows Background

    Whether the background settings of the DataWindow and controls display in the print preview.

    Newspaper Columns Across and Width

    If you want a multiple-column report where the data fills one column on a page, then the second, and so on, as in a newspaper, select the number and width of the columns in the Newspaper Columns boxes. See Printing with newspaper-style columns.


Printing with newspaper-style columns

When you define a DataWindow object, you can specify that it print in multiple columns across the page, like a newspaper. A typical use of newspaper-style columns is a phone list, where you want to have more than one column of names on a printed page.

Use Print Preview to see the printed output

Newspaper-style columns are used only when the DataWindow object is printed. They do not appear when a DataWindow object runs (or in Preview). Therefore, to see them in PowerBuilder, use Print Preview in the DataWindow painter.

To define newspaper-style columns for a DataWindow object

  1. Build a tabular DataWindow object with the data you want.

  2. Select Properties from the DataWindow object's pop-up menu.

  3. Select the Print Specifications tab.

  4. Specify the number of columns across the page and the width of columns in the Newspaper Columns Across and Newspaper Columns Width properties.

    For each control in the DataWindow object that you do not want to have appear multiple times on the page (such as headers), select Properties from the control's pop-up menu and select the HideSnaked check box on the General page in the Properties view.

Example

This example describes how to create a newspaper-style DataWindow object using the Employee table in the PB Demo DB.

Create a tabular DataWindow object, selecting the last name, first name, and phone number columns, and add a title, page number, and date.

The Emp_Fname column and the text control holding a comma are defined as Slide Left, so they display just to the right of the Emp_Lname column.


On the Print Specifications page of the DataWindow object's Properties view, specify two columns across and a column width of 3.5 inches in the Newspaper Columns boxes. (Make sure that Units is set to inches on the General property page.)

To view the DataWindow object as it will be printed, place the pointer in the Preview view and select File>Print Preview.

The DataWindow object displays the result set in two columns. Everything above the column headers (which includes page number, title, and date) also shows twice because of the 2-column specification. This information should appear only once per page.

To specify that page number, title, and date appear only once on the page, you need to suppress printing after the first column. For each of these controls, select Properties from the control's pop-up menu. Then set the HideSnaked property.

The finished DataWindow object has one set of page heading information and two columns of column header and detail information.