JReport introduces an access control ability which can restrict different users to export report result to different formats.
You can restrict the report result formats for users by passing values to a variable. That is the global variable enableTypes in both customize_panel.jsp and save_result.jsp files in <install_root>\public_html\dhtmljsp
folder. The value of enableTypes should be Integer, and JReport gives you the following integers to represent the corresponding report result types:
Report Result Format | Int. Value |
---|---|
HTML | 0 |
1 | |
Excel | 2 |
Text | 3 |
RTF | 4 |
XML | 5 |
PostScript | 6 |
You can specify a value or an array to enableTypes using the integers in the above table. Or you can also use the integers which are not mentioned above, but if you do so, the Int. values will be ignored, and do not function. That is to say, if you pass the array {1,2,5,9,-2} to enableTypes, 9 and -2 will be ignored and {1,2,5} will work, so PDF, EXCEL, XML formats can be in use.
Assume that there are two users, user1 and user2. When user1 logs on, run a report in Page Report Studio, he can only export the report result as PDF and HTML formats. While user2 can export the report result as RTF and XML formats when logging on. To realize it, you can use the following codes in customize_panel.jsp or save_result.jsp file:
|