ReportDocument.ExportToHttpResponse Method (CrystalDecisions.Shared.ExportOptions,System.Web.HttpResponse,Boolean,String)

Exports a report to the response object in the specified format.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration
Public Overrideable Sub ExportToHttpResponse ( _
    ByVal options As CrystalDecisions.Shared.ExportOptions, _   
    ByVal response As System.Web.HttpResponse, _    
    ByVal asAttachment As Boolean, _    
    ByVal attachmentName As String _    
) 
public virtual void ExportToHttpResponse (
    CrystalDecisions.Shared.ExportOptions options,
    System.Web.HttpResponse response,
    bool asAttachment,
    string attachmentName
)

Parameters

  • options
    The options for the export of the report.
  • response
    The response object of the page.
  • asAttachment
    Indicates whether or not the report will be exported as an attachment of the response.
  • attachmentName
    The file name to export the report.

Example

This example exports a report to the browser as a PDF document.

'Declaration

      Dim rptDocument As ReportDocument = new ReportDocument()
      rptDocument.Load("Report.rpt")
      Dim exportOpts As ExportOptions = new ExportOptions()
      Dim pdfOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
      exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
      exportOpts.ExportFormatOptions = pdfOpts
      rptDocument.ExportToHttpResponse(exportOpts, Response, False, "")
      
      ReportDocument* reportDocument = new ReportDocument();
      reportDocument->Load("Report.rpt");
      ExportOptions* exportOpts = new ExportOptions();
      PdfRtfWordFormatOptions* pdfOpts =
         ExportOptions::CreatePdfRtfWordFormatOptions();
      exportOpts->ExportFormatType =
         ExportFormatType::PortableDocFormat;
      exportOpts->ExportFormatOptions = pdfOpts;
      reportDocument->ExportToHttpResponse(exportOpts, Response, false, "");
      
      ReportDocument reportDocument = new ReportDocument();
      reportDocument.Load(@"Report.rpt");
      ExportOptions exportOpts = new ExportOptions();
      PdfRtfWordFormatOptions pdfOpts = ExportOptions.CreatePdfRtfWordFormatOptions();
      exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
      exportOpts.ExportFormatOptions = pdfOpts;
      reportDocument.ExportToHttpResponse(exportOpts, Response, false, "");
      

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports .NET 10

See Also

Reference

ReportDocument Class
ReportDocument Members
CrystalDecisions.CrystalReports.Engine Namespace