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.

NoteUse 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.

StepsTo 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.

  5. 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 EAS Demo DB.

  1. 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.

    The sample shows a tabular DataWindow object. The Header band displays the title Employee Phone List, the date, represented by today ( ), amd tje Employee Name and Phone columns. The Detail band displays two asterisks and the columns emp _ l name, emp _ f name, and phone. The Summary band displays the page number represented as ’ Page ’ + page ( ) .
  2. 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.)

  3. 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.

  4. 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.

The sample displays a single centered title, Employee Phone List, with the date beneath it. Then there are two pairs of repeated headings across the report for Employee Name and Phone, with four columns of data under the headings.