The following example is a simple JSP page that demonstrates how to use the export control to export the first 3 pages of a report to RTF.
<%@ page import="com.crystaldecisions.report.web.viewer.ReportExportControl" %> <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceF actory, com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2, com.crystaldecisions.reports.reportengineinterface.IReportSource" %> <%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions" %> <%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportForm at" %> <%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.IRTFWordExportFo rmatOptions" %> <% String report = "/reports/sample.rpt"; IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory(); IReportSource reportSource = (IReportSource) rptSrcFactory.createReportSource(report, request.getLocale()); ReportExportControl exportControl = new ReportExportControl(); ExportOptions exportOptions = new ExportOptions(); exportOptions.setExportFormatType(ReportExportFormat.RTF); RTFWordExportFormatOptions RTFExpOpts = new RTFWordExportFormatOptions(); RTFExpOpts.setStartPageNumber(1); RTFExpOpts.setEndPageNumber(3); exportOptions.setFormatOptions(RTFExpOpts); exportControl.setReportSource(reportSource); exportControl.setExportOptions(exportOptions); exportControl.setExportAsAttachment(true); exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), null); exportControl.dispose(); %>
| Crystal Decisions http://www.crystaldecisions.com/ Support services http://support.crystaldecisions.com/ |