JReport Server provides you with a JavaScript function which allows you to open the report result or export it in a specified format. You can find this function in the file API.js in <server_install_root>\public_html\javascript\dhtml
, as shown below:
function user_oneStepExport(type, options)
The following explains this function's two arguments, type and options, in detail.
type - Specifies the export format.
options - Specifies the values of the options of each format. It is a string array whose member is of the format "key=value". The options and their usage are listed as follows:
Key | Description | Available Value | Default Value | |
---|---|---|---|---|
HTML | ||||
to_ver | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
browser | Specifies the web browser type. | 0 - IE or Chrome
1 - Firefox |
0 | |
imagetype | Specifies the type of the images in the result file. | 0 - Decided by JReport
1 - GIF 2 - JPG |
0 | |
overflow | Specifies the overflow type. | 0 - VISIBLE
1 - HIDDEN 2 - VERFLOWCOUNT |
0 | |
resolution | Specifies the HTML resolution. | Any integer between 1 and 4294967296 | 96 | |
title | Specifies the title for the HTML file. | Any string | "" | |
applet | Specifies whether or not to export chart in Java applet format. | true, false | true | |
css | Specifies whether or not to embed the cascading style sheet in the exported HTML files. | true, false | false | |
multi | Specifies whether or not to generate an HTML file for each page of the report result. | true, false | false | |
hyperlink | Specifies whether or not to contain hyperlinks in the HTML file. | true, false | false | |
pagenumber | Specifies whether or not to contain page numbers in the HTML file. | true, false | false | |
drilldown | Specifies whether or not to include the drilled-down file in the exported HTML file. | true, false | false | |
no_margin | Specifies whether or not to remove the original margins. | true, false | false | |
absolute | Specifies whether or not to make the font size fixed in the web browser. | true, false | false | |
to_ver | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
no_margin | Specifies whether or not to remove the margin. | true, false | false | |
simulate | Specifies whether or not the mode is to be Simulated Printing Mode. | true, false | true | |
standard | Specifies whether or not to set the mode as Standard Mode. | true, false | false | |
content | Specifies whether or not to contain the TOC in the exported PDF file. | true, false | false | |
drilldown | Specifies whether or not to include the drilled-down file in the exported PDF file. | true, false | false | |
encrypt | Specifies whether or not to encrypt the report result. | true, false | false | |
compress | Specifies whether or not to compress the images in the report. | true, false | false | |
ratio | Specifies the percentage with which to compress the images in the report. | Any integer between 1 to 100 | 20 | |
compatibility | Specifies the encryption compatibility. | 0 - Acrobat 3.0 and later
1 - Acrobat 5.0 and later |
1 | |
doc_psw | Specifies the password for opening the PDF file when encrypt=true. | Any string | "" | |
permi_pasw | Specifies the password for printing and editing the PDF file when encrypt=true. | Any string | "" | |
printing | Specifies the PDF printing mode. | 0 - Prevents users from printing the file
4 - Allows low resolution-printing 2052 - Allows high-resolution printing |
0 | |
changes | Defines which editing actions are allowed in the PDF file. | 0 - Prevents users from making any changes to the file 1024 - Allows inserting, deleting, and rotating pages 256 - Allows users to fill in form fields and adding digital signatures. 32 - Allows users to fill in form fields and add digital signatures and comments 40 - Allows users to do anything except extracting pages 2108 - Allows all |
0 | |
enable_copy | Specifies whether or not to allow users to copy the file contents. | true, false | false | |
enable_access | Specifies whether or not to let visually impaired users read the document with window readers. | true, false | true | |
PostScript | ||||
to_ver | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
no_margin | Specifies whether or not to remove the margins in the PS file. | true, false | false | |
RTF | ||||
to_version | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
rtf_flow | Specifies whether or not to apply a flow layout when exporting the report to RTF. | true, false | false | |
no_margin | Specifies whether or not to remove the margins in the RTF file. | true, false | false | |
Text | ||||
to_ver | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
repeat | Specifies whether or not to replace a field value of a record with that of its previous record if the field value is null. | true, false | false | |
compress | Specifies whether or not to compress the clearance between columns. | true, false | false | |
win_linebreak | Specifies whether or not to use Windows end-of-line characters. | true, false | true | |
normal | Specifies whether or not to generate the report result to a standard text file. | true, false | true | |
quote_mark | Specifies whether or not to mark the fields in the exported file with quotation marks. | true, false | false | |
head_foot | Specifies whether or not to contain all headers and footers in the report. | true, false | true | |
delimiter | Specifies the delimiter. | Any single character | ||
width | Specifies the user-defined character width. | An integer | ||
height | Specifies the user-defined character height. | An integer | ||
Excel | ||||
to_ver | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
wrap | Specifies the word-wrap setting. | 0 - All Keep Existing
1 - All Disabled 2 - All Enabled |
0 | |
new_layout | Specifies whether or not to use the new layout mode. | true, false | true | |
shapes | Specifies whether or not to include the shapes in the exported file. | true, false | false | |
excel_2000 | Specifies whether or not to export the result in Data Format, which means only the report data will be exported without format. | true, false | false | |
advanced | Specifies whether or not to apply the advanced options. | true, false | false | |
header | Specifies the page header text. | Any string | ||
footer | Specifies the page footer text. | Any string | ||
gridline | Specifies whether or not to print gridlines when printing the exported Excel file. | true, false | false | |
XML | ||||
to_ver | Specifies whether or not to save the result to version. | true, false | false | |
to_open | Specifies whether or not to export and open the result file. | true, false | false | |
to_local | Specifies whether or not to save the result to a local file. | true, false | false | |
only_data | Specifies whether or not to only contain the database column information in the exported XML file. | true, false | false | |
schema | Specifies the name of an existing schema file with its full path with which to generate the XML file. | An existing schema file with its full path. |
Notes:
var html_options = ["imagetype=1", "resolution=120", "hyperlink=true", "no_margin=false", "title=hello world"];
Then, you can use user_oneStepExport(0, html_options)
to obtain a URL for exporting the report result in HTML format.