导出到 .net 中的 Excel

发布于 2024-09-10 14:53:35 字数 1516 浏览 7 评论 0 原文

我在包含水晶报表 crReportbyApp.rpt 的 ReportByApp.aspx 页面中有以下用于导出到 Excel 的代码

            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()

,但它引发了如下异常:

文件错误 c:\inetpub\wwwroot\epapm\crReportbyApp.rpt:错误 由导出 DLL 检测到:“

“CrystalDecisions.CrystalReports.Engine”

StackTrace at .F(字符串, 引擎异常错误ID) 在.A(Int16,Int32) 在.@(Int16) 在 CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext 请求上下文) 在 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType 格式类型) 在AppCrystalReport.btnExportToExcel_Click(对象 发送者,EventArgs e)in
c:\inetpub\wwwroot\epapm\ReportByApp.aspx.vb:line 311" 字符串

请任何人帮助我。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

霊感 2024-09-17 14:53:35

这似乎是 Crystal Reports 引擎中的一个错误。 (http:// Social.msdn.microsoft.com/forums/en-US/vscrystalreports/thread/c11d5168-8ee1-49b1-aa45-800c09e46b71/ & http://forums.asp.net/t/1363585.aspx)

有一个修复程序。但是,安装修补程序的风险由您自行承担(IE 在服务器上安装之前对其进行测试)。

请注意,我没有遇到过这个问题,也没有重现它并解决它。这只是我在网上的研究。

Link to the hotfix information:

Symptom
安装 Windows 2003 Server 的 Service Pack 2 后,ASP.Net Web 应用程序在导出为 Excel 格式时显示错误。

CrystalDecisions.CrystalReports.Engine.ExportException:文件 C:\WINDOWS\TEMP\temp_.rpt 中出现错误:
导出 DLL 检测到错误

原因
这是 Crystal Reports for VS.NET 2003 的一个已知问题,并且已被跟踪。轨道 ID 为 ADAPT00756601

分辨率
解决该问题的修补程序已发布。该问题可以通过在开发计算机上应用修补程序并将“exportmodeller.dll”复制到部署计算机来解决。

如果问题出现在开发和部署机器上,请按照以下步骤操作:
在开发机器中应用“Hotfix”。
重新启动开发机器。
在部署计算机上找到“exportmodeller.dll”文件。
重命名“exportmodeller.dll”文件或备份旧的“exportmodeller.dll”。
应用修补程序后,从开发计算机复制更新的“exportmodeller.dll”文件。
将新的“exportmodeller.dll”文件粘贴到已重命名旧文件的部署计算机中。即确切的路径。
重新启动部署机器。
可以从下面提到的 URL 下载此问题的修补程序:

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

关键字
导出 DLL 检测到错误,在 VS.NET 中导出到 Excel,文件中出现错误,8342631

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

世界和平 2024-09-17 14:53:35

该错误位于 ExportModeller.dll v 9.1.1.527 中。您必须安装 pach。

就像这里报道的那样(意大利语)http://blogs.sysadmin。它/ermanog/archive/2009/04/28/3258.aspx
您必须下载名为 crnet11win_en.zip 的水晶报表补丁(可以在 google 上搜索),解压该文件中的压缩文件,然后替换您计算机站点中的文件
c:\%ProgramFiles%\file comuni\水晶决策\bin\1.0
并替换名为 ExportModeller.dll 的文件,以便 dll 的版本必须为 9.1.1.528 而不是 9.1.1.527。

如果你看这里可以发现文件 crnet11win_en.zip 已经解压
https://skydrive.live.com/?cid=174281e704ea1a69&id=174281E704EA1A69 %21176

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文