on 09-09-2008 10:29 PM
I'm currently embedding crystal within a wicket application in which I'm making use of the getHtmlContent() method to retrieve the report's HTML. For whatever reason, I'm not able to get either the export or print icons (on the top left side of the viewer). Is this because I'm using the getHtmlContent() method or do I have something misconfigured somewhere? Setting the setHasExportButton(true) and setHasPrintButton(true) on the report viewer object has no effect.
If I run the same report using the generated JSP outside of my application (within tomcat), I see the export/print buttons. I notice the JSP makes use of the processHttpRequest() method. Any help will be greatly appreciated.
Thanks!
Louis
Hi Louis
- The getHtmlContent() method handles the user's request to generate the HTML for the report and returns the HTML as a String.
Note: Either the getHtmlContent method or the processHttpRequest method can be used to handle the user's request to generate the HTML for the report, depending on how you write your JSP. If the viewer's content is displayed more than once, then the getHtmlContent method is more efficient, because the request is processed once and the resulting HTML string can be used multiple times. In this case, you must set the content type of the HTML, as recommended in the table. Additionally, using getHtmlContent sets setOwnPage to false and disables exporting and printing.
- The setOwnPage(true) and processHttpRequest() method should be used if you want the export and print button to appear in the report viewed through Crystal Report Viewer.
Following is the snippet of code which shows you how to use these 2 methods.
//Get the IReportSource object from sesion and pass it to the viewer
IReportSource reportSource = (IReportSource)session.getAttribute("reportSource");
//----
Create the viewer and render the report -
//create the CrystalReportViewer object
CrystalReportViewer oCrystalReportViewer = new CrystalReportViewer();
//set the reportsource property of the viewer
oCrystalReportViewer.setReportSource(reportSource);
//set viewer attributes
oCrystalReportViewer.setOwnPage(true);
oCrystalReportViewer.setOwnForm(true);
//set the CrystalReportViewer print mode
//oCrystalReportViewer.setPrintMode(CrPrintMode.ACTIVEX);
oCrystalReportViewer.setPrintMode(CrPrintMode.PDF);
//process the report
oCrystalReportViewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
Hope this helps you .
Thanks
Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The processHttpRequest() is not an option for us. We're not using JSP but instead we're relying on the wicket web framework to handle the response. The processHttpRequest() appears to call getWriter() which causes an IllegalStateException("WRITER") to be thrown when the wicket framework eventually calls getOutputStream() (later in the response handling).
So if I hear you right, you're saying that the export/print buttons on the report viewer will not be available if we use the getHtmlContent() method. To get the the buttons to appear, we have to make use of the processHttpRequest() method, right?
Thanks!
Louis
Hi Louis
When using the 'getHtmlContent' method with the CrystalReportViewer, the 'Export' and 'Print' buttons do not appear even though the 'isOwnPage' property is set to True.
This is the default behavior of the 'getHtmlContent' method.
To display these buttons, use the 'processHttpRequest' method and set the 'isOwnPage' property to True.
Thanks
Soni
Hi Louis
For more information on getHtmlContent and processHttpRequest methods ,please refer the following link.
http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
In that ,on the left hand side you have to go the Java Reporting component SDK->JRC API Reference.
I am not really aware if the export/print buttons will be available in the future with getHtmlContent method.
Thanks
Soni
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.