Exemple 1 - Exportation d'un rapport

L'exemple suivant est une page JSP simple qui montre comment utiliser le contrôle d'exportation pour exporter vers RTF les trois premières pages d'un rapport.

Remarque :    Le rapport utilisé dans cet exemple n'est pas inclus dans les tutoriels.

exportreport.jsp

<%@ page import="com.crystaldecisions.report.web.viewer.ReportExportControl" %>

<%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.RTFWordExportFormatOptions" %>

<%

    Object reportSource = session.getAttribute("reportSource");

    if (reportSource == null)

    {

       String report = "/reports/sample.rpt";

       ReportClientDocument reportClientDoc = new ReportClientDocument();

       reportClientDoc.open(report, 0);

       reportSource = reportClientDoc.getReportSource();

       session.setAttribute("reportSource", reportSource);

    }

    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);

%>



Business Objects
http://www.france.businessobjects.com/
Support technique
http://www.businessobjects.com/services/support/