Skip to content

PrintReport - cDRReport

Methods - Properties - Events

Method Type

Procedure

Arguments

Argument Description
hPrintDlg A handle to a PrintDlgEx structure or zero.

Description

Prints the report depending on the report output destination settings.

When a zero is passed as an argument, the class creates and pops up a printer selection dialog. If you do not want the dialog to pop up, the argument should contain a handle to a PrintDlgEx structure. psPrinterName needs to be set to a valid printer, and peOutputDestination should be PRINT_TO_PRINTER_NO_DIALOG.

The OnPrintReport event is fired at the beginning of the print. The print can be canceled by setting pbCanceled the PRINTDLGEX structure can also be changed or set.

A Popup message is sent to the object whose ID is stored in phoStatusPanel when pbShowStatusPanel is true. The popup is shown before the COM message is sent and removed when the COM message has finished.

At the end of the method, the event OnPostPrintReport is fired.

This method cannot be used before the report OCX object is initialized. The COM object creation is performed as part of the OpenReport method if it has not been done previously.

DataFlex Framework usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'
End_Object

Object oRunReportButton is a Button
    Set Label to 'Run Report'

    Procedure OnClick
        String sReportId

        Get OpenReport To sReportId
        // Prints the report, not passing a valid
        // printer device context handle
        Send PrintReport of oReport 0
    End_Procedure
End_Object

Object oPrintReportToDefaultPrinterButton is a Button
    Set Label to 'Print Report'

    Procedure OnClick
        String sReportId

        Get OpenReport To sReportId
        Set peOutputDestination of oReport to PRINT_TO_PRINTER_NO_DIALOG
        Send PrintReport Of oReport 0
    End_Procedure
End_Object