Skip to content

ExportReport.wo

The ExportReport webview can be used in a typically drill-down style web project to export the results of a report to one of the available export formats.

The view allows for exporting the report to the following formats: PDF, CSV, various image types, HTML, XLS, and RTF. For each format, different options are available. Upon clicking OK, the export will be opened in the browser.

Export Report Webview

Example

There is an example of its use in the WebOrderMobile workspace.

In the example, various Results web components (e.g., SalesPersonOverviewReportResults.wo) contain a cWebMenuItem object to open the ExportReport webview.

In the code below, it is important to notice that the path to the ExportReport webview is registered using WebRegisterPath, and that the OnClick event starts the navigation.

The ExportReport webview is opened, collects the choices from the user as NamedValuePair[] values, and the Web Framework allows the developer to handle it via the OnNavigateBack event. The OnNavigateBack below calls ExportReportToDownloadURL, a method defined in the cDRReport class to further handle the export of the report.

Use ExportReport.wo

Object oExportReportMenuItem is a cWebMenuItem
    Set psCaption to "Export Results"
    Set peActionDisplay to adMenu

    WebRegisterPath ntNavigateForward oExportReportWebView

    Procedure OnClick
        Send NavigatePath
    End_Procedure

    Procedure OnNavigateBack Handle hoCallback tWebNavigateData NavigateData
        Send ExportReportToDownloadURL of oReport NavigateData.NamedValues
    End_Procedure
End_Object

Notes

In DataFlex Reports 24.0, a new feature was added to control what export options should be available. The new feature contains the declaration of the following cDRReport class properties:

In order to respect these settings, the application that opens the export options dialog needs to send the message CopyExportOptions to the oExportReportWebView. This means the above example code changes to:

Procedure OnClick
    Send CopyExportOptions of oExportReportWebView (oReport)
    Send NavigatePath
End_Procedure

When using the new pbShowXXX properties, ensure that the peExportType does not conflict with one of the property settings.