Skip to content

ExportReport - cDRReport

Methods - Properties - Events

Method Type

Procedure

Arguments

Argument Description
iExportType The export file format. Can be one of the export type constants.
sFileName The filename of the file to create.

Description

Exports the opened report in the chosen format to the chosen filename.

At the beginning of the routine, the OnExportReport event is fired. Export can be stopped by setting pbCanceled to true in that event.

Sends the Popup message to the object-id stored in the phoStatusPanel property if the property pbShowStatusPanel is true.

Do not forget to also set the corresponding export format options via one of the following methods: Set pPDFExportOptions, pCSVExportOptions, pImageExportOptions, pHTMLExportOptions, pRTFExportOptions, or pXLSExportOptions. If these values are missing, the DataFlex Reports OCX cannot operate correctly and might crash.

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

Using a filename without a path is not advised because it is unclear where the file is created. Use of ReportCacheFolder is suggested.

This method cannot be used before the report OCX object is initialized. The COM object creation is - when not done before - created as part of the OpenReport method.

DataFlex Framework usage

  • Web
  • Windows
  • FlexTron

Sample

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

Object oExportReportButton is a Button
    Set Label to 'Export Report'

    Procedure OnClick
        String sReportId
        drPDFExportOptions PDFExportOptions

        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            // set the export options
            Get DefaultPDFExportOptions of oReport to PDFExportOptions
            Move 'MyPassword' to PDFExportOptions.sOwnerPassword
            Move 'UserPassword' to PDFExportOptions.sUserPassword
            Set pPDFExportOptions of oReport to PDFExportOptions
            Send ExportReport of oReport C_drPDF 'c:\tmp\MyReport.pdf'
            Send CloseReport Of oReport sReportId
        End
    End_Procedure
End_Object