ResultVersionView.java can be found in <server_install_root>\help\samples\APIClient\ViewReport
. The Client API classes are included in <server_install_root>\lib\JRViewer.jar
. To work with ResultVersionView.java to view a result version and export it to different formats, follow the steps below:
import jet.client.api.*;
import jet.client.api.gui.*;
The method setProxy (String proxyHost, String proxyPort) sets the proxy for the client.
Parameters:
The method setUser(string user) sets the user ID of the report server at the client end.
The method setPassword(string password) sets the user password.
The method (Frame frame, string jrsvrURL) is used to log onto the report server jrsvrURL. A login dialog will be displayed for you to enter user ID and password.
Parameters:
http://localhost:8888/
or http://localhost:8888/jrserver/
.The method getResultVersions(Frame frame, String reportURL) returns the result versions of a report in a report server.
Parameters:
http://localhost:8888/jrserver/SampleReports/SampleReports.cat/InvoiceReport.cls.
|
The method exportVersionResult() is used to export a version result to different formats. It returns whether or not it is successful.
There are a couple of exportVersionResult
methods with different parameters. The method being used in the demo contains the following parameters:
Note: The method exportVersionResult() is deprecated. It has been replaced by exportVersionResult (String rptURL, String versionResult, String rstFile, String htmlFile, String pdfFile, String txtFile, String excelFile, String psFile, boolean isNormalText, boolean isRepeat, char delimiter, boolean isMultiFiles, boolean isChartApplet, boolean hasHyperlink, boolean hasPageNumber, boolean useTable, boolean relFontSize, int webBrowser).
The method viewResultVersion (String rptUrl, String resultVersion, String title) views a report result version and returns a ViewerThread object. A report viewer frame is brought up by the ViewerThread.
Parameters:
http://localhost:8888/SampleReports/SampleReports.cat/CustomerAnalysis.cls
.getResultFilename()
of VersionRecord. The VersionRecord list of a report can be obtained from the method getVersionList(...)
of this class.The method showVersionParamValues (Frame frame, String jrsvrURL, String versionID, String title) brings up a dialog to show the report parameter values of the result version.
Parameters:
getVersionID()
of VersionRecord. The VersionRecord list of a report can be obtained from the method getVersionList(...)
of this class.The method setSystemExitWhenWindowClosed() sets the system to exit when the result viewer is closed.
Assume that the demo program is in C:\JReport\Server\help\samples\APIClient\ViewReport
, and JReport Server has been installed to C:\JReport\Server
.
To compile and run the demo program, you should add certain files with their paths into the class path. For example, use the following command to compile the test program:
|
When you run the programs, you should provide the following parameters.
An example for running the program:
|
By running the program, you can view the result of the report CustomerAnalysis.cls.