Skip to content

HTMLPreviewData - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

String[][]

Arguments

Argument Description
sReportID ID of the report. Can be ID of the main report or the ID of a sub-report. This argument can be passed as an empty string. The empty string can be written as C_USEMAINDRREPORTID.
iBlockSize The maximum size of each element in the resulting array. To avoid the strings getting larger than the argument size in DataFlex, it is advised to keep this value low.

Description

Returns an HTML-based report export in an array of string values. The number of array elements equals the full HTML report size divided by the iBlockSize parameter. The function is designed to be used together with the previewer class for a DataFlex 17.1 (or higher) web project.

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.

The GenerateReportHTML function uses this HTMLPreviewData function.

DataFlex Framework Usage

  • Web
  • Web controls in a FlexTron application

Sample

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

    Function HTMLPreviewData String sReportId Integer iBlockSize Returns String[][]
        String[][] sData

        // No matter what was passed as iBlockSize use 1000 as the value. Since this value is lower than
        // the argument size (default 64kb) and does not need to be checked
        Forward Get HTMLPreviewData sReportId 1000 to sData

        Function_Return sData
    End_Function
End_Object

Object oWebMainPanel is a cWebPanel
    Set pbFillHeight to True

    Object oViewer is a cWebDRReportViewer
        Set phoReport to oReport
    End_Object
End_Object

Object oRunReportButton is a cWebButton
    Set Label to 'Run the report'

    Procedure OnClick
        Send ShowReport of oViewer
    End_Procedure
End_Object

Notes

  • For use with DataFlex versions prior to DataFlex 20.0, the returned HTML data will be Base64 encoded. This is done to avoid an OEM conversion which was standard in DataFlex versions prior to DataFlex 20.0. The Base64 strings will be converted back to Unicode by the JavaScript class used for the cWebDRReportViewer object.