With JReport Enterprise Server, you may view reports in different formats, such as HTML, PDF, Excel, etc. For HTML format, there are two viewing modes - pure HTML or dynamic HTML (DHTML). Dynamic HTML provides a dynamic report view at the client side. You may change some options to get the results to display the way you want.
In versions as early as JReport Enterprise Server 4.5, DHTML was already supported. However, it provided only simple features, such as Table of Contents (TOC) support and a Drill-down feature.
JReport Enterprise Server now provides support for more features, such as Filter, Sort, Drill-to, Drill-down, Drill-up, Navigation (TOC), Search, Save Result, and so on.
Furthermore, JReport DHTML supports web design feature, allowing you to create reports using report oriented data structures, save your report, and even save your report as another report.
Topics covered in this chapter:
To view reports in Dynamic HTML,
- Launch JReport Enterprise Server.
- Log on to the home page of JReport Enterprise Server using the JReport Console port, such as http://localhost:8888 or http://<host>:<port>/jreport/jinfonet in an embedded environment.
- Browse to the page that contains your report, and then click the AdvancedRun button for that report in the Control column.
- Switch to the Format tab, make sure To DHTML is selected in the Select type of View Format drop-down list.
- Click the Submit button. The JReport DHTML window will appear.
You can open multiple reports in the DHTML window in one session. This means that each time when you run a DHTML report, it will be opened in a new window. Also, when working in the embedded mode, you can assign frames to the reports, so that more than one DHTML report can be viewed in one window at the same time.
You are able to specify the maximum number of reports that can be run in one session. To do this,
- Click Preferences on the top banner of the Server Administration page (http://localhost:8889), click the DHTML tab.
- At the bottom of this page, check the Number of Report per Session box, and type in the number in the text box.
If this box is unchecked, you can open an unlimited number of reports.In order to illustrate how to view multiple frames in one window, a demo is provided for you. Please follow the steps below:
- Go to
<install_root>\help\en\srv-materialto findMultipleReports.zip.- Extract
MutipleReports.zipto<install_root>/public_html.- Access JReport Enterprise Server using
http://localhost:8888/test.jsp.
The main page of DHTML consists of the menu bar, toolbar, navigation bar, TOC, and report area.
Options for browsing or controlling the DHTML report result are as the following:
Menu Command Description Report New Creates a new report based on the existing queries. Save Result Saves the report result to disk or version in various format. Save Saves the report as a report version. Save As Saves a copy of the report. Export To Exports the report result to various formats, such as html, PDF, text, Excel, postscript, rtf, and xml. Page Setup Specifies the page settings for the report result. Prints the current report result. Close Close the current active report view, enabled when multiple reports are opened. Exit Quits and closes the DHTML window. Edit Undo Undo the last operation. Redo Reverse operation of Undo. Search Finds specific text. Find Next If you have closed the Search dialog box, you can use this command to continue searching for the same text. Find Previous If you have closed the Search dialog box, you can use this command to locate the last found text position. Reset Reproduces the report using the data cached in the data buffer. Refresh Runs the report using the previously provided parameters. The Refresh operation fetches data again. View User Information Panel Shows the User Information Panel, from which you can get the user name, catalog name and report name. TOC Shows TOC Browser, with which you can navigate the report data. Tool Bar Shows the Tool Bar. Navigation Bar Shows the Navigation Bar. Sort If the report is not grouped, click it and the Sort On Detail Panel will show, with which you can sort the report records in ascending or descending order on the field(s) you select from the drop-down list. If the report is grouped, it has two submenu items - Sort On Groups, and Sort On Detail, with which you can sort the groups and the detail records respectively. Filter Shows the Filter Panel, with which you can filter the report records according to the filter criteria you specify. Customize Allows you to customize the toolbar. Pop-up Menu Shows the pop-up menu when you right click a DBField or a label. Skin Allows you to choose one skin color theme. Navigation First Page Goes to the first page of report. Prev Page Goes to the previous page. Next Page Goes to the next page. Last Page Goes to the last page. Context Menu Filter Filters the data in your report. Sort ascending Sorts the selected column in ascending order. Sort descending Sorts the selected column in descending order. Sort By Others Sorts the groups by a field, record-level formula, or summary. Drill Down Drills down one group level to show the records for a particular group. Drill Up Drills up one group level to show the records for a particular group. Search Finds text in your report using Search dialog. Page Specifies the page settings for the report result. Report Shows the report properties. Properties Shows the object properties.
The major features of controlling the DHTML report result view are:
- Filter
Enables you to set a series of conditions to re-produce the report by filtering the data buffer where data is cached.- Sort
Enables you to sort records in the data buffer according to the sort settings.- Drill To
Enables you to re-produce the report with records of a certain group shown.- Drill Down
Enables you to drill down one group level to show the records of a particular group.- Drill Up
Enables you to drill up one group level to show the records of particular group.- Navigation
Enables you to navigate the report by using the Table of Contents (TOC) panel.- Search
Enables you to search for any text in the report.- Export
Enables you to export the report result to various formats, such as PDF, HTML, Text, and so on.- Save Result
Enables you to save the report result as a version.- Style Group
Enables you to apply style groups to the report.- Zoom
Enables you to enlarge or reduce the size of the report result.
In DHTML, the data is cached in a data buffer. You can set a series of conditions and apply to a DHTML server to filter the data buffer and reproduce the report. There are three methods that you can use to set the filtering conditions:
- Use the Filter panel;
- Use the pop-up menu;
- Use labels.
Use the Filter panel
To show the Filter Panel, on the View menu, click Filter, or click the Filter button on the toolbar. You can add, edit, or remove any filtering conditions on the Filter panel.
You can finish a filter condition by either selecting the field value from the drop-down list, or typing the values manually in the value fields. This is controlled by the button behind the value field. When the button is Input Value, click it to type the value manually, and then the button will change to Select Value which means you can select a value from the drop-down list. After you have finished with the filter condition, click Apply to get the data you want. Click Next or Previous to browse to the next or previous page of values.
To add a row, select And or Or from the Relationship drop-down list.
To remove a row, click the Delete this condition button.
Note: When you set a condition expression that contains date type field values, please follow the correct date sample that is automatically provided in the Value field.
Use the pop-up menu
You can also use the Filter command on the pop-up menu to filter the data in your report.
- Move your cursor on the column in the Report Area on which you want to filter data, and then click the right mouse button.
- Choose the Filter command on the pop-up menu. On the sub-menu of Filter, some options and DBField values are displayed, select them to filter the data.
All
No filter.
Top/Bottom N
Filter to display records that meet the topN or bottomN condition. The value specified as top/bottom N must be a positive integer.
For example, if you input 3 on the Filter Top N dialog for a certain field, only the records whose field value equals one of the top three field values will be displayed.
Actual values
Choose an actual value from the sub-menu, and the filtered result will be displayed immediately.
More
If there are too many available values to display on the sub-menu, click More to bring out the Filter More Values dialog to view other values.
Select Value - All the available values are displayed in the Select Value drop-down list for you to choose.
List Size - Specifies a number to divide the values in the Select Value drop-down list into pages, and use Next and Previous to browse them. Please remember to press ENTER after typing the number.
You can also type the filtering value manually. Click the Input Value button, and type the value in the Input Value text box.
Click OK to filter the data according to the condition you have made.- After you filter the data, you can see the filtering condition displayed on the Filter Panel.
Use labels
You can also use a label to control the filter condition for the data.
This feature needs to be enabled at report design time.
- In JReport Designer, set the Filterable property of this label to
true.- Bind the label to a column that you want to filter by setting the column as the value of the BindColumn property.
- Save and deploy the report to server.
- Click the button to filter the data, using the same way as the pop-up menu. Also, you will get the corresponding filtering conditions on the Filter Panel.
Sometimes you may want to change the field names displayed on the Select Field drop-down list to make them more readable, and sometimes you may only need to show a small number of field names on the Select Field drop-down list. You can customize the display name for the fields in your report at design time.
- In JReport Designer, on the Edit menu, click Edit Display Name.
- Add the mapping rows to the mapping list.
- Select the field name from the Resource Name column.
- Double-click the cell in the Display Name column to edit the display name for this field.
- Mark the check box in the Sort or Filter column, which will apply the display name settings to the sort or filter panel in DHTML, and then click OK.
The mapping list controls the field display names, and the number of the mapping rows determines the number of mapping names to be displayed on the Sort/Filter panel in DHTML.
For more information, click the Help button on the Edit Display Names dialog.
Notes:The relationship between the newly created condition and the former condition is AND.
See also Reference | Dialog | Filter Panel.
You can sort detail records and groups in the data buffer on certain DBFields. You can achieve this in the following ways:
Use the Sort On Detail panel to sort detail records
You can use the Sort On Detail Panel to set the sorting conditions.
- On the Sort submenu of View menu, click Sort On Detail.
- In the first row of the Field column, select a field name.
When you fill in the Field column, the Sort Order is set to Ascending by default. Ascending order sorts from A to Z or 0 to 9.
To change the sort order, select Descending from the Sort Order list. Descending order sorts from Z to A or 9 to 0.- Click the Add button (
) to add a new row of the sorting conditions.
Click the Move Up button () or Move Down button (
) to move a row up or down.
The expression in the first row is the first sorting level (the largest set). The second row is the second sorting level, and so on.
Click the Remove button () to remove a row of sorting conditions.
- Click Apply to accept the changes and re-load the report result using the sort settings.
To clear all fields on Sort On Detail Panel, click Reset.Use the pop-up menu to sort detail records
You can also use the Sort ascending/Sort descending command on the pop-up menu to sort records on a certain field.
- Move your cursor on the column in the Report Area on which you want to sort records, and click the right mouse button.
- Choose the Sort ascending or Sort descending command from the Context menu.
After you click Sort ascending or Sort descending, the sort settings you have made will be reflected in the Sort On Detail Panel.
- To sort on more than one field, repeat steps 1 and 2. The sorting conditions will be appended to the end of the expression list on the Sort On Detail Panel.
You might have noticed that the sorting commands work only the first time you execute the sorting command. When you try to sort on another field, it will not work. This is because when you use the sorting commands on the context menu to sort on different columns, the sort condition will be appended to the sort condition list on the Sort On Detail Panel. You will not see the sorting result until you click the Apply button on the Sort on Detail Panel.
Use the Sort On Groups panel to sort groups
You can use the Sort On Groups Panel to set the sorting conditions for sorting groups.
- On the Sort submenu of View menu, click Sort On Groups.
- From the Sorting on drop-down list, select a group to be sorted on.
- Select a field, record-level formula, or summary from the field drop-down list, and then check Ascending or Descending to set the sorting order.
Click the Remove button () to reset the sorting condition.
- Click Apply to accept the changes and re-load the report result using the sort settings.
To clear the condition on the Sort On Groups Panel, click Reset.Use the pop-up menu to sort groups
You can also use the Sort By Others command on the pop-up menu of a group to sort this group on a certain field, record-level formula, or summary.
- Move your cursor to a group header area or a group footer area, and click the right mouse button.
- Choose the Sort By Others command from the Context menu.
After you click Sort By Others, the Sort On Groups Panel will be displayed, and then you can set the sorting condition according to the steps said in Use the Sort On Groups panel to sort groups.You might have noticed that the Sorting On drop-down list is gray and can not be accessed. This is because you access the Sort On Groups Panel by right-clicking a certain group, and the system makes the group as the default group to be sorted.
Use labels
You can use a label to control the sorting order for a certain column.
This feature should be enabled at report design time.
- In JReport Designer, set the Sortable property of this label to
True.- Bind this label to the column on which you want to sort by setting this column as the value of the BindColumn property.
- Save and deploy the report to the server.
Customized Display Name
The sort and filter panel supports a customized display names feature, see the section Filter the report data.Notes:
- You cannot sort on a global type formula.
- The sort process is based on group and broken by group. During the sorting process, the records in different groups will be re-arranged separately (by group) according to their sort order. This may sometimes make the sort result look disordered when the number of records in each group is very small.
In the following diagram, records in the ID column are sorted in their own groups individually in ascending order.
Note: See also Reference | Dialog | Sort On Detail Panel.
In the DHTML report, you can select to show certain groups of records according to your requirements. You can also switch among the groups to see the data you want.
As indicated in the following diagram, drill-up means you jump up one group level to show the records of a certain group, drill-down means you jump down one group level to show the records of a certain group. Drill-to means that you can jump from any group to any other group.
You can use the Context menu to perform the drill-up/drill-down operations. To show the Context menu, place your cursor over a section other than a page header or page footer, and then click the right mouse button. On the Context menu, point to the Drill Down/Drill Up sub-menu, and then pick the group that you want to show. The report data will be re-loaded from the data buffer, showing only the records in the selected group.
Whether the Drill Down (Drill Up) sub-menu is enabled, and what contents are on the preceding sub-menu depends on the position where you click the right mouse button. If the section where you place your mouse pointer contains no sub-groups, then the Drill Down sub-menu will be shown as grayed.
Chart Drill Down
We can drill down on a chart that contains summaries. When you move your mouse to an area of chart, the mouse cursor will change to a hand, and the value of this summary will be displayed. If you click on the summary (e.g. a bar in chart), then you can drill into the detail information of the summary.
Customized Display Name
Drill To supports the customized display names feature, see the section Filter the report data.
You can use the TOC Browser to navigate through a report. To show the TOC Browser, on the View menu, click TOC.
On the TOC Browser, expand the Group Name node, select the Group Value node that you want to browse to. The page that contains the matching data will then be shown.
The table of contents in the TOC Browser is organized in a tree structure. The root node represents the report you are viewing. The group names show by which fields the records are hierarchically grouped and the group value ranges. Under the group name nodes are group values.
Summary value shown in TOC after filtering data
When you filter the data in a report, the summary will be recalculated based on the remaining records. The recalculated summary value will be shown in the TOC, with the summary value before filtering displayed behind it in a pair of parentheses. For example, Sum of SUM_TOTAL: $620.50($1,008.00).TOC in JReport Designer
Just like a report, the format of the TOC is designed in JReport Designer. Under the Report root node in Report Inspector, there is an object named TOC. You can modify its properties on the Property Sheet window.
TOC Anchor
Besides the groups, you can also add your own nodes to the TOC Browser. Most objects in JReport Designer have a property called TOCAnchor that holds a Boolean value. If the TOCAnchor property is true, a node for this object will be added to the TOC tree. When you click such a node, the page that contains this object will be displayed in the report area.Some objects, such as group panels, summaries, sub-reports, and data objects hold a true value for the TOCAnchor property by default, which also means that by default they will appear in the TOC.
You can use the Search dialog to find text in your report. To show the Search dialog, on the Edit menu, click Search, or right click on a DBField or a label, and on the pop-up menu, click Search. You can find the content you want in two places - in the values of certain fields, or in the report content.
To find text in the values of certain fields,
- Make sure the Content option is NOT checked.
- Select a field from the Field Name drop-down list.
- Select the field value you want to search for from the Search Value drop-down list. If the value doesn't appear in the list, select another range in the Value Range drop-down list.
- Click the Next button.
To find text in the report content,
- Check the Content check box.
- Type the search content in the Search Value box.
- Click the Next button.
If the content is found, it will be highlighted using high contrast colors.
Notes:
- Do not use any extra characters (including spaces) in your search.
- Make sure that the search key word is exactly the same as the target word that you want to find.
- If you don't select the Content option, you are not able to search strings in Special Fields.
For information on how to use the Search Panel, refer to Reference | Dialog | Search Panel.
You can export the report to other formats, such as PDF, Excel, RTF, HTML, Text, PostScript, and XML.
To do this, on the Tools menu, point to Report, point to Export To, and then select the file format that you want to export.
For help with the exporting options, please click the Help button on the Export dialog.
Download the report results in one step
Rather than viewing the exported report in the browser window, you can also download the exported report in one single step. JReport Enterprise Server provides you with a JavaScript function that allows you to add a download option in your own pages -
downloadReport(type).You can find this function in the
default.jsfile, located at<install_root>\public_html\dhtmljsp\js, as shown below:
var JREPORT_PDF = 0; var JREPORT_EXCEL = JREPORT_PDF + 1; var JREPORT_RTF = JREPORT_EXCEL + 1; var JREPORT_TEXT = JREPORT_RTF + 2; var JREPORT_PS = JREPORT_TEXT + 1; var JREPORT_XML = JREPORT_PS + 1; function downloadReport(type) { setSrc('connect', '278&ty=' + type, true); }Call this function in your own HTML page to download the exported report immediately.
In order to assist you with the usage of this function, we provide two demo JSPs for you, which are included in the zip file
<install_root>\HELP\en\srv-material\1stepdl_demo.zip.
- Extract these two JSPs (
main.jspandfolder.jsp) to<install_root>\public_html- Access it using the following URL:
http://localhost:8888/main.jsp- In the left frame pane, click Report to open a demo report, click API to reveal the Download Report option.
- Check the Download Report option, select a file format, and then click download.
Export a report in one step
JReport Enterprise Server provides you a JavaScript function that allows you to export a report to a particular format in one single step -
oneStepExport(type, options), which is located in thedefault.jsfile under<install_root>\public_html\dhtmljsp\js, as shown below:
var HTML = 1; var PDF = 2; var TEXT = 3; var EXCEL = 4; var PS = 5; var RTF = 6; var XML = 7; var IE=0; var Netscape=1; var Mozilla=2; var DEFAULT=0; var JPEG=1; var GIF=2; var simulated_mode=0; var standard_mode=1; var Keep_Existing=0; var All_Disabled=1; var All_Enabled=2 function oneStepExport(type, options) { setSrc('connect','295&ty=' + type + '&' + options, true); }Below is the explanation of the two parameters:
- type - Specifies the exporting format. It can be HTML, PDF, TEXT, EXCEL, PS, RTF, or XML.
- option - Specifies the values of the options of each format. The options and their usage are listed below:
- HTML
html_single: A boolean value. If it is true, the report will be exported to a single HTML file.
html_noHyperlink: A boolean value. If it is true, the exported HTML file will not contain the hyperlinks.
html_noPageNumber: A boolean value. If it is true, the exported HTML file will not contain page numbers.
html_noMargin: A boolean value. If it is true, the margin which you set while designing a report will be removed, and you can specify a margin in the exported HTML file.
html_relative: A boolean value. If it is true, the font size in the exported file can be adjusted in the browser.
html_table: A boolean value. If it is true, the format of the exported HTML will be in a table tag.
html_applet: A boolean value. If it is true, Java applets will be used to display charts in the exported file.
html_drillDown: A boolean value. If it is true, the drill down file will be included in the exported HTML file.
int html_resolution: Specifies the resolution you specify. By default, it will be the resolution of your monitor, which is normally 96 dpi.
int html_browser: Specifies the web browser with which you want to view the HTML format result file. It can be IE, Netscape, and Mozilla.
int html_imageFormat: Specified the format of the image. It can be DEFAULT, JPEG, and GIF.
pdf_noMargin: A boolean value. If it is true, the margin which you set while designing a report will be removed.
pdf_compress: A boolean value. If it is true, the images in the report will be compressed.
int pdf_percent: When pdf_compress is true, this option is used to specify the percentage to compress the images in the report. By default, it is 20%.
pdf_toc: A boolean value. If it is true, the report result will be exported to PDF file with a table of contents.
pdf_drilldown: A boolean value. If it is true, the report result will be exported to PDF file with the drill-down feature enabled.
pdf_encrypt: A boolean value. Specifies whether to set a password for the exported PDF file.
String pdf_password: When pdf_encrypt is true, this option is used to specify a password for the exported PDF file.
String pdf_confirmpw: Confirms the password of the exported PDF file.
int pdf_simulated: Specifies the mode when exporting the report result to a PDF file. It can be simulated_mode and standard_mode.
Simulated Printing Mode - When you export to PDF, JReport will take the result of the whole report as graphic to traverse the report by the method of simulating printer and generate a PDF file.
Standard Mode - The result of using Standard Mode is the same as the one using Simulated Printing Mode. However, when you export to PDF using Standard Mode, JReport will take the result of the whole report as a data set to traverse the report by sequence and generate a PDF file.- Text
text_standard: A boolean value. If it is true, the report result will be exported to a standard text file.
text_quoteMark: A boolean value. If it is true, fields in the exported text file will be marked with quotation marks.
text_header_footer: A boolean value. If it is true, the exported file will contain all headers and footers in the report, including Report Header/Footer, Page Header/Footer and Group Header/Footer. If it is false, the exported file will only contain data in the Detail section.
text_compress: A boolean value. If it is true, there will be no clearance between columns.
int text_hDensity: Specifies the value for each unit of the horizontal density between columns. The density of the result is direct ratio with the value you specified. That is to say, the greater the value is, the smaller the width between columns. The default value is -1.
int text_vDensity: Specifies the value for each unit of the vertical density between columns. The density of the result is direct ratio with the value you specified. That is to say, the greater the value is, the smaller the height between columns. The default value is -1.
String text_delimiter: Specifies the delimiter to separate the fields in the exported text file. The default value is “,”.- Excel
excel_is2k: A boolean value. If it is true, and if you set the ExportToXLS property of a page section (Report Header Section, Page Header Section, Detail Section, and so on) to False, all the objects in this section will not be exported, regardless of their ExportToXLS properties.
excel_hasShape: A boolean value. If it is true, the shapes will be included in the exported file.
int excel_wordWrap: Specifies the word-wrap settings. It can be Keep_Existing, All_Disabled and All_Enabled.
Keep_Existing - Keeps all the settings of each object's WordWrap property specified in the report.
All_Disabled - Disables the WordWrap property for all objects, the Wordwrap property will be made false for all the objects.
All_Enabled - Enables the WordWrap property for all objects, the Wordwrap property will be made true for all the objects.
excel_matchLayout: A boolean value. If it is true, the exported Excel layout will try to match the original report layout.- PS
ps_noMargin: A boolean value. If it is true, the margins you set in the report design time will be removed.- RTF
rtf_noMargin: A boolean value. If it is true, the margins you set in the report design time will be removed.- XML
xml_onlyData: A boolean value. If it is true, the exported XML file will contain only the database column information.
String xml_schemaFilename: Specifies an existing schema file name with its full path for generating the XML file.Below is an example of using this function:
If you want to export a report to the HTML format, and the values of options are “Single File”, “No Page Number”, “No Margin” and the type of “Image Chart” is GIF, you can use the function in the Web Control like this:
oneStepExport(HTML, 'html_single=true&html_noPageNumber=true&html_noMargin=true&html_imageFormat=GIF')
For the options that have not been specified in the function, the default values for them will be used in the exported file.You can use your own method to call this function to export a report to a particular format, and also JReport Server provides you a method to implement it - adding exporting buttons to the DTHML toolbar.
Adding buttons to the DHTML toolbar for one step export
Seven buttons are provided for the one step export function on the toolbar, they are Export to PDF, Export to Excel, Export to RTF, Export to HTML, Export to Text, Export to PS, and Export to XML. By default, the buttons are invisible on the toolbar. You have to add these buttons to the toolbar by modifying the dhtmlmain.jsp file under
<install_root>\public_html\dhtmljsp.The following two API functions are used to control the buttons:
customizeToolbar(String userId, int buttonId, boolean isVisible)customizeToolbar(String userId, int buttonId, boolean isVisible, String method)The values of the parameter
buttonIdcan be
- DHTMLConstant.BTN_EXPORT_TO_PDF
- DHTMLConstant.BTN_EXPORT_TO_EXCEL
- DHTMLConstant.BTN_EXPORT_TO_RTF
- DHTMLConstant.BTN_EXPORT_TO_HTML
- DHTMLConstant.BTN_EXPORT_TO_TEXT
- DHTMLConstant.BTN_EXPORT_TO_PS
- DHTMLConstant.BTN_EXPORT_TO_XML
which allows you to specify different types of exporting format.
For example, if you want to add the Export to HTML button to the toolbar, Please do as follows:
- Open the file dhtmlmain.jsp under
<install_root>\public_html\dhtmljsp.- Add the code
service.customizeToolbar(runtimeId, DHTMLConstant.BTN_EXPORT_TO_HTML, true);before
DHTMLToolkit tool = service.getDHTMLToolkit();Start JReport Server, run a report in the DHTML format, and you will see a new button Export to HTML is displayed on the toolbar.
To add more than one button to the toolbar, for example, adding Export to HTML and Export to PDF buttons to the toolbar,
- Open the file dhtmlmain.jsp under
<install_root>\public_html\dhtmljsp.- Add the code
service.customizeToolbar(runtimeId, DHTMLConstant.BTN_EXPORT_TO_HTML | DHTMLConstant.BTN_EXPORT_TO_PDF, true);before
DHTMLToolkit tool = service.getDHTMLToolkit();Start JReport Server, run a report in the DHTML format, and you will see the buttons Export to HTML and Export to PDF are displayed on the toolbar.
Click the added button on the toolbar of the report DHTML page, the report will be exported to the corresponding format, using the default values of the format options.
If you want to specify some values of the options when exporting a report, you should also modify dhtmlmain.jsp. For example, when exporting a report to the HTML format, and the values of the options are “Single File”, “No Page Number”, “No Margin” and the type of “Image Chart” is GIF.
- Open the file dhtmlmain.jsp under
<install_root>\public_html\dhtmljsp.- Add the code
String options = "’html_single=true&html_noPageNumber=true&html_noMargin=true&html_imageFormat=GIF’";to the dhtmlmain.jsp file before
service.customizeToolbar(runtimeId, DHTMLConstant.BTN_EXPORT_TO_HTML, true, "oneStepExport(HTML, " + options + ")");
DHTMLToolkit tool = service.getDHTMLToolkit();- Start JReport Server, run the report in DHTML file, and then click the Export to HTML file. You will get the HTML report result you have specified.
You may want to save the report result as a version when you are satisfied with the result.
To save the report result as a version,
- On the Report menu, click Save. The Save Result panel will then appear.
- Select a format to save the version as. There are several formats you can select, including HTML, PDF, TEXT, Excel, PostScript, Rich Text Format, and XML.
Set the options for the result format you select.
Note: For a detailed description of each option, refer to Reference | Dialog | Save Result.- If you have selected a format, such as PDF, Text, and so on (except HTML), a check box named Save in Local will appear. This check box enables you to save the report result to your local disk.
- Click OK to save the report result as a version. If Save in Local is checked, the File Download dialog will pop up for you to open or save the report result to you local disk.
A style group is a set of styles that you can apply to a report to quickly change its appearance and characteristics. You can create and set up your own styles and style groups in JReport Designer. After that, you can deploy your reports to JReport Enterprise Server. When you schedule the report, you enable the style group feature and select a style group to apply to the report. For information about the Styles and Style Groups, see JReport Designer User's Guide | Using Styles in Your Report.
By default, the style group feature is enabled in JReport DHTML. You can select a style group from the DHTML toolbar.
Note:
JReport Enterprise Server provides a set of style groups that work as a demonstration to show how the style groups affect a report. However, these demo style groups only apply to reports that contain table objects and crosstabs. For reports that contain crosstabs, you can apply these demo style groups directly by simply selecting them from the DHTML toolbar, while for the report that contains table objects, you must specify a style group for the Pattern property of the report in Report Inspector first. Then you can apply these demo style groups. For information about the Pattern property, see JReport Designer User's Guide | Using Styles in Your Report.
In most cases, your reports are related instead of being isolated from each other. Each report may emphasize particularly on one or more certain aspects. In some circumstances, you may want to set up certain relationships among your reports so that the user can browse from one report to another through the relationship "channels" that you create.
Such an inter-report relationship network can be achieved by setting up "Join" and "WherePortion" conditions between two reports. You can use one report to hold comprehensive report data, and the other to show detailed information on a specific topic, where the "Join" or "WherePortion" conditions are created.
JReport reports can be joined together to compose a master-detail report group. Normally, a master report holds more comprehensive data, while detail reports hold related detail information. A detail report can be the master report of another report. In this way, by setting up more and more pairs of master-detail reports, many reports can be joined together, and a report chain is formed.
To set up a pair of master-detail reports, please refer to JReport Designer Manual | User Guide | Editing a Report For DHTML Use | Showing detailed information for comprehensive data using master/detail reports.
To use master detail reports in JReport DHTML,
- Develop the reports with master detail relationship in JReport Designer.
- Deploy the reports to JReport Enterprise Server.
- Run the master report in DHTML format on JReport Enterprise Server.
- Click the trigger field in the master report.
- You may be prompted to provide encoding or DB security information before the report result is produced.
Click OK if you want to run a detail report using the same encoding and DB security settings as that of the master report.
- The detail report will show only the records in that specific group.
![]()
You can use the DHTML tab to customize DHTML features according to your requirements. If you don't need some of the features, you can turn them off.
To configure DHTML features,
- Log on to JReport Enterprise Server using the administration port (8889 by default) or the service port (8888 by default).
- Click Preferences on the top banner, and then click the DHTML tab.
- Check the features you want to keep and clear the features you want to switch off.
- Click Apply when you finish.
For more on this, see JReport Enterprise Server dialogs | The Service (Administration) Pages | Preferences | DHTML.
Each opened DHTML report holds many resources, whether or not it interacts with server. As a result, many opened reports will decrease server performance.
You can improve DHTML performance by preventing large numbers of DHTML reports from being opened simultaneously.
To set the maximum number of DHTML reports that can be opened together,
- Log on to JReport Enterprise Server using the administration port (8889 by default).
- Click Preferences on the top banner, and then click the DHTML tab.
- Check the Max. No. of Open Reports option and then type a number in the box.
- Click Apply when you finish.
Notes:
- The Max. No. of Open Reports option controls the maximum number of all the reports open on JReport Server, while the Max. No. of Reports/Session option controls the maximum number of the reports open in one session.
- The Max. No. of Open Reports option works together with the maximum number of concurrent reports allowed by the product license you purchased, and the smaller number is used as the real maximum opened reports limit. For example, if the value of the Max. No. of Open Reports option is 10, and the number that the license allows is 20, 10 will be the maximum number of reports that can be open simultaneously. JReport Server uses the smaller number as the maximum number of concurrent reports.
If the number of opened report exceeds the limit, an error page will be displayed, prompting you to close a report before opening a new report.
For more on this, see JReport Enterprise Server dialogs | The Service (Administration) Pages | Preferences | DHTML.
Some of DHTML operations consume a lot of memory space and CPU processing power. The Action Task Manager improves DHTML service performance by preventing a large number of actions from running simultaneously.
The Action Task Manager coordinates DHTML actions through two fixed-size tables:
- Concurrent Processing Table - This registers the requests that are currently being processed by the DHTML service.
- Waiting Requests Queue - This registers the requests that are waiting to be processed by the DHTML service.
Note: Only some operations that consume considerable hardware resources need to be prevented from running at the same time. You can define which kind of requests need to be queued before being processed.
When a new DHTML request reaches the server, it will be processed according to the following flow:
- The DHTML service determines whether the requested operation is a restricted action. If it is, the Action Task Manager will take over the request. Otherwise, it will be processed directly, without being managed by the Action Task Manager.
- If the Concurrent Processing Table is full, the restricted request will be assigned to the Waiting Requests queue. When the queue is full, the DHTML service will refuse the request and return a warning message.
- After the request has been processed, it will be deregistered from the Concurrent Processing table, and the DHTML service will automatically continue to process the requests in the Waiting Requests Queue.
By using the property file that we provide (
dhtml.properties), you can balance the server load by adjusting table sizes and determining which kind of requests are managed by the Action Task Manager.dhtml.properties
The
dhtml.propertiesfile is located at<install_root>/bin/. It allows you to control three major options for Action Task Manager:
- Specify the size of the Concurrent Processing Table
Usequeue.actions.max.concurrent=[integer]to set the maximum number of requests that can be processed simultaneously. The value of this property can be equal to or larger than 0. Use 0 (default) to disable the request queue feature.- Specify the size of the Waiting Requests Queue table
Usequeue.actions.max.pending=[integer]to set the maximum number of to-be-handled requests that the queue can contain. The value of this property can be equal to or larger than 0. 0 means no requests will be stored in the queue. A request will either be handled by DHTML service or be rejected when the maximum limit of the Concurrent Processing table has been reached.- Specify the actions that can be applied for the DHTML Request Queue feature.
These are listed as below:
queue.actions.init=false # Action: DHTML report initialization
queue.actions.undo=true # Action: Undo
queue.actions.redo=true # Action: Redo
queue.actions.drill=true # Action: Drilling
queue.actions.drillup=true # Action: Drilling up
queue.actions.refresh=false # Action: Refreshing
queue.actions.filter=true # Action: Filtering
queue.actions.sort=true # Action: Sorting
queue.actions.search=true # Action: Searching
queue.actions.finishNewReport=true # Action: Finish creating a new report
These properties work only when the queue feature has been enabled by settingqueue.max.concurrent.actions>0.
True - The action will be handled by the Action Task Manager.
False - The action will not be handled by the Action Task Manager and will be directly processed by DHTML service without being queued.
For topics about web design, please refer to the following sections:
Operations in sub-reports are not supported by the Filter, Sort, Drill, and Search feature.