Printing the report

After you build the DataWindow object and fill in print specifications, you can place it in a DataWindow control on a window or form, as described in “Putting a DataWindow object into a control”.

To allow users to print the report, your application needs code that performs the printing logic. For example, you can place a button on the window or form, then write code that is run when the user clicks the button.

To print the contents of a single DataWindow control or DataStore, call the Print method. For example, this statement prints the report in the DataWindow control dw_Sales:

dw_Sales.Print(TRUE)

For information about the Print method, see the DataWindow Reference.

Separate DataWindow controls in a single print job

If the window has multiple DataWindow controls, you can use multiple PrintDataWindow method calls in a script to print the contents of all the DataWindow controls in one print job.

These statements print the contents of three DataWindow controls in a single print job:

int job
job = PrintOpen("Employee Reports")
// Each DataWindow starts printing on a new page.
PrintDataWindow(job, dw_EmpHeader)
PrintDataWindow(job, dw_EmpDetail)
PrintDataWindow(job, dw_EmpDptSum)
PrintClose(job)

For information about PocketBuilder system functions for printing, see the PowerScript Reference.