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 PowerBuilder statement
prints the report in the DataWindow control dw_Sales:
1 |
dw_Sales.<span>Print</span>(TRUE) |
For information about the Print method, see
the DataWindow Reference. For information about
using nested reports to print multiple DataWindows, see “Using nested reports”.
Separate DataWindow controls in a single print
job
For PowerBuilder applications only
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:
1 |
int job |
1 |
job = PrintOpen("Employee Reports") |
1 |
// Each DataWindow starts printing on a new page. |
1 |
PrintDataWindow(job, dw_EmpHeader) |
1 |
PrintDataWindow(job, dw_EmpDetail) |
1 |
PrintDataWindow(job, dw_EmpDptSum) |
1 |
PrintClose(job) |
For information about PowerBuilder system
functions for printing, see the PowerScript Reference.