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. Create report
To create a new normal report, the main style of the report is designed as follows:
The cell content is shown in the following table:
Cell | Content | Remark |
---|---|---|
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. Effect preview
1) PC
Save the template, click Pagination Preview, the effect is as shown in the figure below:
a) Absolute path
b) Relative path
2) Mobile
Click Moblie Preview, the effect is as shown in the figure below:
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: