当我想将水晶报告保存为pdf文件时,它会再次弹出参数窗口,让我无法保存pdf

时间:2014-11-07 00:54:17

标签: asp.net crystal-reports report

当我打开水晶报表并想将报告保存为pdf文件时,会弹出参数窗口而无法保存pdf文件,你能告诉我如何解决这个问题吗?

这是我的代码:

private ReportDocument boReportDocument = null;

    private void MyLoad(object sender, System.EventArgs e)
    {

            ConnectionInfo connectionInfo = new ConnectionInfo();
            boReportDocument = new ReportDocument();
            string rptFile = this.Page.Request.QueryString["Name"];
            this.Page.Title = this.Page.Request.QueryString["Name"].Replace(".rpt", "");
            boReportDocument.Load(Server.MapPath("~/Crystal/" + rptFile));
            CrystalReportViewer1.ReportSource = boReportDocument;

            connectionInfo.DatabaseName = "XXXX";
            connectionInfo.UserID = "XXXX";
            connectionInfo.Password = "XXXX";
            connectionInfo.ServerName = "XXXX";

            TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo;
            foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
            {
                tableLogOnInfo.ConnectionInfo = connectionInfo;

            }


    }


    public ReportsView()
    {
        this.Initialize();
        this.Load += new EventHandler(MyLoad);

    }

我使用水晶报告版本13.0.2000 sp5,(我之前安装sp12)同样的问题.. visual studio 2010

由于

Userstation

1 个答案:

答案 0 :(得分:0)

您可以使用导出到httpresponse直接导出到.pdf。

而不是

CrystalReportViewer1.ReportSource = boReportDocument;

试试这个

boReportDocument.ExportToHttpResponse(
    CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, 
    Response, False, "REPORTNAME")