JS モバイルからのエクスポートを実現

  • 作成者:FRInternational
  • 編集回数:1次
  • I. Overview

    1. Version dependency

    Designer versionHTML5 Mobile Display plugin versionApp version
    10.0V10.4.975V10.4.975

    2. Application scenarios

    The mobile terminal supports exporting cpt reports as: Word, Excel, PDF, and image. Effect as shown below:

    1.gif


    3. Export scheme

    Now the mobile terminal provides an export interface, and users can realize the effect of exporting files on the mobile terminal through JavaScript code.

    Currently, only cpt reports are supported, and the interface is supported in all locations that support triggering JS: cell hyperlinks, parameter widget event, data entry widget event, web event, etc.

    The four file export codes are shown in the following table:

    JavaScriptParameter description
    contentPane.exportReportToExcel('Specify format');


    Export Excel: when the parameter is page, it is exported by pages; when it is simple, it is exported as it is; when it is sheet, it is exported by pages and by sheet.
    contentPane.exportReportToImage('Specify format');


    Export image: The parameter can be png, jpg, gif, bmp, and the format is png without parameter
    contentPane.exportReportToPDF();


    Export PDF
    contentPane.exportReportToWord()
    Export Word

    II. Example

    1. Prepare template

    Open the designer's built-in template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Chart\ColumnAndBar\Layered_Axis_Label.cpt


    2. Add button widget

    Add four buttons at the top of the template, which are used to export Word, PDF, Image, and Excel from left to right. As shown below:

    2.png


    3. Add event for button widget

    Take export PDF button as an example, add a click event to the button, and fill in the export code, as shown in the figure below. The other three buttons are set in the same way, just change the code.

    3.png

    See I.3 Export scheme for JavaScript code.


    4. Effect preview

    Save the template, click Mobile Preview, choose Data Entry, use the enterprise WeChat to scan the QR code, effect is shown in the following figure:

    1.gif

    III. Download template

    Refer to the completed template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\JS\JS_ExportFile.cpt

    Click to download: 

    JS_ExportFile.cpt

    IV. Precautions

    1. Issues on iOS

    1) Export image

    After the image is exported on iOS, there may be a problem that the image name is not the template name.


    2. Issues on Android

    1) Export Excel and PDF

    When exporting PDF and Excel files in personal WeChat, if you open them directly with the built-in browser, the session may fail and the file cannot be opened.

    The current solution is to install the QQ browser and open the file in the QQ browser.

    2) Export Word

    Some models do not support opening doc files, you need to manually change the file suffix (bin-->doc).


    Attachment List


    Theme: FineMobile
    既に最初
    既に最後
    • Helpful
    • Not helpful
    • Only read