Skip to Content
avatar image
Former Member

Export and Print icons missing from report viewer

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 09, 2008 at 09:56 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Louis!

      Even I got stuck at the same place.... Will you please put the code snippet of your work around so all poor souls trying to set up Crystal Report Viewer with Wicket will be at ease.

      Thanks in advance.