Crystal报表文件路径 [英] Crystal report file path

查看:90
本文介绍了Crystal报表文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试显示报告,但此行发生错误



rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,false,ExportedReport.pdf);

ERROR



CrystalDecisions.CrystalReports.Engine.dll中出现CrystalDecisions.CrystalReports.Engine.LoadSaveReportException类型的例外但不是用户代码处理



附加信息:无效的报告文件路径。



我有什么试过:



代码:



I try to display report but an error occurred in this line

rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport.pdf");
ERROR

An exception of type 'CrystalDecisions.CrystalReports.Engine.LoadSaveReportException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code

Additional information: Invalid report file path.

What I have tried:

Code:

private void ViewReport()
        {
        rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport.pdf");

          Response, false, "ExportedReport.pdf");

            if (rpt != null)
            {
                rpt.Dispose();
                rpt.Close();
            }
        }







rpt = new ReportDocument();

string sRptPath =ERPSolution-NL / Admin_Reports / CR /;

string sRptTitlePrefix =;




rpt = new ReportDocument();
string sRptPath = "ERPSolution-NL/Admin_Reports/CR/";
string sRptTitlePrefix = "";

推荐答案

在处理ASP&时检查您的路径Crystal Reports您需要了解报告存储位置相对于运行它的位置。

执行此操作的最佳方法是使用网站根目录的完整路径而不是从你运行报告的地方开始的相对路径。

假设你有以下结构;

www.myweb.com

www。 myweb.com/viewReport.aspx

www.myweb.com/ERPSolution-NL/Admin_Reports/CR/myReport.rpt

执行报告&从viewReport.aspx查看(或下载)它你应该使用以下内容。

Check your path, when dealing with ASP & Crystal Reports you need to be aware of where the Report is stored relative to where you are running it from.
The best method of doing this is to use a full path from the root of your website instead of a relative path from wherever you are running the report from.
Assuming you have the following structure;
www.myweb.com
www.myweb.com/viewReport.aspx
www.myweb.com/ERPSolution-NL/Admin_Reports/CR/myReport.rpt
To execute the report & view (or download) it from viewReport.aspx you should use the following.
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("~/ERPSolution-NL/Admin_Reports/CR/myReport.rpt"));





亲切的问候



Kind Regards


这篇关于Crystal报表文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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