dot Net Crystal Reports Export Problems

We will face many problems to export crystal reports. If we have no space in our servers or we don't want to export it to server harddrive with ReportDocument.Exporttodisk() method. Rather we export it with this method we also can export direct to HTTP response on client side by this method ReportDocument.ExportToHttpResponse().

[VB]

Public Overrideable Sub ExportToHttpResponse( _
ByVal formatType As CrystalDecisions.Shared.ExportFormatType, _
ByVal response As System.Web.HttpResponse, _
ByVal asAttachment As Boolean, _
ByVal attachmentName As String _
)

[C#]

public virtual void ExportToHttpResponse(
CrystalDecisions.Shared.ExportFormatType formatType,
System.Web.HttpResponse response,
bool asAttachment,
string attachmentName
);

For Example :

[C#]
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(@"Report.rpt");
reportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "");

[VB]
Dim reportDocument as new ReportDocument()
reportDocument.Load(@"Report.rpt")
reportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "");

Parameters

formatType

The format type to export 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.


Requirements

Namespace CrystalDecisions.CrystalReports.Engine

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



Sunday, April 12, 2009

0 Comments: