views:

53

answers:

1

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.

A: 

This appears to be a bug in the Crystal Reports engine. (http://social.msdn.microsoft.com/forums/en-US/vscrystalreports/thread/c11d5168-8ee1-49b1-aa45-800c09e46b71/ & http://forums.asp.net/t/1363585.aspx)

There is a hotfix for it. However, install a hotfix at your own risk (IE test it out before installing on your server).

Please note that I have not experienced this issue and have not reproduced it and resolved it. This is just from my research online.

Link to the hotfix information:

Symptom
After installing Service Pack 2 for Windows 2003 Server, the ASP.Net Web application displays an error while exporting to Excel format.

CrystalDecisions.CrystalReports.Engine.ExportException: Error in File C:\WINDOWS\TEMP\temp_.rpt: Error detected by export DLL

Cause
This is a known issue with Crystal Reports for VS.NET 2003 and has been tracked. The Track ID is ADAPT00756601

Resolution
Hotfixes addressing the issue have been released. The issue can be resolved by applying the hotfix on the development machine and copying the "exportmodeller.dll" to the deployment machine.

If the issue occurs on development and deployment machine, follow the steps given below: Apply "Hotfix" in the development machine. Restart the development machine. Locate "exportmodeller.dll" file on the deployment machines. Rename the "exportmodeller.dll" file or backup the old "exportmodeller.dll". Copy the updated "exportmodeller.dll" file from development machine after applying the hotfix. Paste the new "exportmodeller.dll" file into the deployment machines where you had renamed the older one. i.e., the exact path. Restart the deployment machine. The Hotfix for this issue can be downloaded from the URL mentioned below:

ftp://ftp1.businessobjects.com/outgoing/CHF/crnet11win_en.zip

Keywords
Error Detected by Export DLL, Exporting to Excel in VS.NET, Error in File, , 8342631

Nathan Koop
WoW ! Perfect... I had been searcing for solutions since days... n this was Bingo.... :) thanks ! it solved my problem...
RMN