File download by HTML label

  • Last update:May 07, 2021
  • I. Overview

    1. Problem description

    After installing the upload and download plugin, you can set the download file. For details, see: Upload and download file plugin

    But if you don’t want to install a plugin, how can you download files?


    2. Solution

    Download through HTML tags

    II. Example

    This article takes downloading the Contact.xlsx file in the %FR_HOME%\webapps\webroot\help directory as an example, as shown in the following figure:

    1.png


    1. Create report

    To create a new normal report, the main style of the report is designed as follows:

    2.png

    The cell content is shown in the following table:


    CellContentRemark
    A2

    Insert normal text:

    http://localhost:8075/webroot/help/Contact.xlsx

    -
    B2

    Insert normal text:

    ../../help/Contact.xlsx

    The relative path is set according to the specific situation, the template here is in a folder, so it needs to return to two levels
    A3

    Insert formula:

    "<a href='" + A2 + "' download='Absolute path download'>Click to download</a>"

    -
    B3

    Insert formula:

    "<a href='" + B2 + "' download='Relative path download'>Click to download</a>"

    -



    2. Set cell attributes

    Select cells A3 and B3, select Cell Attributes, and set Display Content to Display by HTML. As shown below:

    3.png



    3. Effect preview

    1) PC

    Save the template, click Pagination Preview, the effect is as shown in the figure below:

    a) Absolute path

    4.png

    b) Relative path

    5.png

    2) Mobile

    Click Moblie Preview, the effect is as shown in the figure below:

    6.gif

    Note: App does not support this effect, but HTML5 preview is supported.

    III. Completed template

    Refer to the completed template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BasicApplication\Download_byHTML.cpt

    Click to download: 

    Download_byHTML.cpt


    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy