Cette leçon explique comment exporter les rapports Crystal sous différents formats. Les formats d'exportation disponibles pour le JRC sont les suivants : formats PDF (Portable Document Format), RTF (Rich Text Format), RTF modifiable, CSV (Comma Separated Value) et Crystal Reports. Pour ce tutoriel, nous avons choisi RTF comme format d'exportation.
La boîte de dialogue Nouvelle page JavaServer s'ouvre.
ExportReport.jsp.<%@page import="com.crystaldecisions.reports.sdk.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.reportsource.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.exportoptions.*" %>
<%@page import="com.crystaldecisions.report.web.viewer.*"%>
<%
ReportClientDocument reportClientDoc = new ReportClientDocument();
String report = "/Sample Reports/Customer Profile Report.rpt";
reportClientDoc.open(report, 0);
Object reportSource = reportClientDoc.getReportSource();
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(), out);
%>
Remarque : Cet extrait de code exporte le rapport Customer Profile Report.rpt au format RTF.
Un visualiseur de pages de rapport DHTML Crystal Reports démarre.
| Business Objects http://www.france.businessobjects.com/ Support technique http://www.businessobjects.com/services/support/ |