I have following code for export to excel in ReportByApp.aspx page containing crystal report crReportbyApp.rpt
Dim outstream As System.IO.MemoryStream
Dim strFileName As String
strFileName = "Report_" & Now.ToString("MM-dd-yy") & " " & Now.Hour.ToString & Now.Minute.ToString & Now.Second.ToString & Now.Millisecond.ToString
strFileName = strFileName & ".xls"
outstream = CType(rptDoc.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.Excel), System.IO.MemoryStream)
Response.ClearHeaders()
Response.Buffer = False
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment; filename=" & strFileName)
Response.BinaryWrite(outstream.ToArray)
Response.End()
but it throws an exception as below:
Error in File c:\inetpub\wwwroot\epapm\crReportbyApp.rpt:Error detected by export DLL: "
"CrystalDecisions.CrystalReports.Engine"
StackTrace at .F(String , EngineExceptionErrorID ) at .A(Int16 , Int32 ) at .@(Int16 ) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at AppCrystalReport.btnExportToExcel_Click(Object sender, EventArgs e)in
c:\inetpub\wwwroot\epapm\ReportByApp.aspx.vb:line 311" String
Please anyone help me in this.