Successfully!

Error!

File download by HTML label

  • Last update:  2021-05-07
  • 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

    Doc Feedback