加载报告失败-CrystalDecisions.CrystalReports.Engine.LoadSaveReportException:无效的报告文件路径 [英] Load Report Failed - CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid Report file path

查看:363
本文介绍了加载报告失败-CrystalDecisions.CrystalReports.Engine.LoadSaveReportException:无效的报告文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这个领域的新手,我已经搜索了所有论坛,但没有找到我想要的答案.我有四个报告,其中只有两个可以工作,另外两个显示加载报告失败".我已经检查了代码,它们都是一样的,唯一的区别是参数的数量.我不确定这是否会有所不同,但是我的报告的大小之一是4064KB,而这两个出现错误的报告中有一个,其中有4个子报告.我已经检查了文件路径并赋予了它们完整的权限,并确保我的密码和ID是正确的.我正在VS2010上使用Crystal Report通过快速单击导出按钮"导出到PDF.所有报告都可以在正在开发的计算机上正常运行,但是当我将其安装在另一台计算机上时,会出现此问题.我已经安装了.net Famework 4和4.0框架的Crystal Report Redistributable,不确定是否需要其他工具.这是我的代码,其中有4个子报告,在此先感谢您.

I am a newbie at this, and I have searched all the forums and haven''t found the answer I am looking for. I have four reports and only two of which work, and the other two show "Load Report Failed." I have checked the code and they are all the same, the only difference is the number of parameters. I am not sure if this makes a different but one of my reports'' size is 4064KB and this one of the two that came up with the error, it has 4 sub-reports within it. I have checked my file paths and given them full permissions, and made sure my password and ID are correct. I am using Crystal Report on VS2010 to export to PDF with a "quick click export button". All the reports work fine on my developing computer, but when I install it on another computer it gives me this issue. I had installed .net Famework 4 and Crystal Report Redistributable for 4.0 Framework, not sure if I need anything else. Here is my code for that one with 4 sub-reports, thank you in advance.

Try

           Dim SavingString As String = ""
           'SavingString = "C:\Windows\Temp\" & CStr(Me.MillNameLabel1.Text) & "Quote" & CStr(Me.QuoteNumberLabel1.Text) & ".pdf"
           SavingString = "C:\Reports\" & CStr(Me.MillNameLabel1.Text) & "Quote" & CStr(Me.QuoteNumberLabel1.Text) & ".pdf"
           Dim cryRpt As New ReportDocument
           cryRpt.Load("C:\Program Files\ECSBOM\ECSBOM\ReportTemplates\QuoteReport.rpt")
           cryRpt.SetDatabaseLogon("CrystalReportUser", "123456")

           Dim crParameterDiscreteValue As ParameterDiscreteValue
           Dim crParameterFieldDefinitions As ParameterFieldDefinitions
           Dim crParameterFieldLocation As ParameterFieldDefinition
           Dim crParameterValues As ParameterValues

           crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields

           crParameterFieldLocation = crParameterFieldDefinitions.Item("QuoteNumber")
           crParameterValues = crParameterFieldLocation.CurrentValues
           crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
           crParameterDiscreteValue.Value = CInt(Me.QuoteNumberLabel1.Text)
           crParameterValues.Add(crParameterDiscreteValue)
           crParameterFieldLocation.ApplyCurrentValues(crParameterValues)

           ReportViewForm.CrystalReportViewer1.ReportSource = cryRpt
           ReportViewForm.CrystalReportViewer1.Refresh()

           Dim CrExportOptions As ExportOptions

           Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()

           Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
           CrDiskFileDestinationOptions.DiskFileName = SavingString
           CrExportOptions = cryRpt.ExportOptions
           With CrExportOptions
               .ExportDestinationType = ExportDestinationType.DiskFile
               .ExportFormatType = ExportFormatType.PortableDocFormat
               .ExportDestinationOptions = CrDiskFileDestinationOptions
               .ExportFormatOptions = CrFormatTypeOptions

           End With
           cryRpt.Export()
           Process.Start(SavingString)
           MainForm.WindowState = FormWindowState.Minimized
       Catch ex As Exception
           MsgBox(ex.ToString)
       End Try

推荐答案

由于该代码适用于2个报表,而不适用于其他2个本地报表,因此,您需要对基于环境的原因进行故障排除.

加载报告失败-CrystalDecisions.CrystalReports.Engine.LoadSaveReportException:无效的报告文件路径
此处使用链接中提供的选项进行故障排除:无效的报告文件路径 [ ^ ]
Since, the code is working for 2 reports and not for other 2 + locally, it works, you need to troubleshoot possible environment based reasons.

Load Report Failed - CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid Report file path
Here troubleshoot with options given in the link: Invalid report file path[^]


如果我是我,请仔细检查开发人员计算机上的Crystal Reports版本与代码失败的用户计算机上的Crystal Reports版本.我对SAP v13 Crystal Reports的未更改代码使我出现了CrystalDecisions.CrystalReports.Engine.LoadSaveReportException异常,并显示消息无效的报告文件路径".我还收到了CrystalDecisions.CrystalReports.Engine.InvalidArgumentException异常,消息中包含指定了无效的打印机".

因此,请深入研究CrytalReports真正抛出的内部异常,并检查报告文件路径,打印机设置和您设置的其他属性.新版本似乎对参数的正确性更加挑剔.
If I were you I''d double check the version of Crystal Reports on your developer machine versus the version on the users'' machine where the code fails. My unchanged code with SAP v13 Crystal Reports threw me CrystalDecisions.CrystalReports.Engine.LoadSaveReportException exception with the message "Invalid report file path". I also got CrystalDecisions.CrystalReports.Engine.InvalidArgumentException exception with the message containing "Invalid printer specified".

So dig down into the inner exception what the CrytalReports really threw, check out report file paths, printer settings and other properties you set. The new version seems to be more picky about the correctness of parameters.


这篇关于加载报告失败-CrystalDecisions.CrystalReports.Engine.LoadSaveReportException:无效的报告文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆