Click here to Skip to main content
15,884,948 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Experts,


Our requirement is to export Crystal Report to different formats like Excel,pdf,Rich Text,WordForWindows. We are able to export the report data to all above formats except Excel. The code which we are using to export to excel is working fine in development environment. Once we hosted the same in IIS 7.0, able to export to all above formats except Excel file. For few reports able to export to excel and for few reports unable to export it. We are struggling on the issue since a week. And didn't get the root cause for that. Below is the sample code that we are using to export to excel file. The current environment that we are using Visual Studio 2008, Sql Server 2008 and IIS 7.0.
C#
ReportDocument rpt1 = new ReportDocument();
rpt1 = Session["ReportData"] as ReportDocument;
 
oStream = (MemoryStream)
rpt1.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-disposition", "attachment; filename=Excel.xls");
//Response.BinaryWrite(this.oStream.ToArray());
Response.BinaryWrite(oStream.ToArray());
Response.End();// Also tried with this. But didn't see any change in behaviour. HttpContext.Current.ApplicationInstance.CompleteRequest();


Please help me on this. Thanks in advance for your help.

Regards,
Taraka Rajesh
Posted
Updated 13-Oct-14 2:57am
v2
Comments
KaushalJB 14-Oct-14 2:52am    
Have you installed Latest Crystal Reports RunTime on your server ?? Install it and then try

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900