开发者

Export to excel in .net

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 D开发者_Python百科LL: "

"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.


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


The error is in the ExportModeller.dll v 9.1.1.527. You must install the pach.

Like reported here (in italian) http://blogs.sysadmin.it/ermannog/archive/2009/04/28/3258.aspx you have to download the patch for crystal report named crnet11win_en.zip(can find searching on google), estract the file zipped in that file , and replace the file in your machine site on c:\%ProgramFiles%\file comuni\crystal decision\bin\1.0 and replace the file named ExportModeller.dll so that the version of the dll must be 9.1.1.528 and not 9.1.1.527.

If you look here can find the file crnet11win_en.zip already estracted https://skydrive.live.com/?cid=174281e704ea1a69&id=174281E704EA1A69%21176

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜