【问题标题】:Report fails to print and export to PDF报告无法打印并导出为 PDF
【发布时间】:2016-07-29 09:36:00
【问题描述】:

我正在使用 asp.net 网络表单 Crystal 报表。报告在我传递参数时生成,但无法打印并导出为 PDF。单击导出按钮时没有任何反应,并且没有错误消息。

protected void Button1_Click(object sender, EventArgs e)
{
    SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString);
    ReportDocument test = new ReportDocument();
    cn.Open();
    SqlCommand cmd = new SqlCommand("SELECT_DATA", cn);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataTable ds = new DataTable();
    cmd.Parameters.Add(new SqlParameter("@INPUT", TextBox1.Text));
    da.Fill(ds);
    test.Load(Server.MapPath("EOR.rpt"));
    test.SetDataSource(ds);
    test.SetParameterValue("input", TextBox1.Text);
    CrystalReportViewer1.ReportSource = test;
    CrystalReportViewer1.DataBind();
    cn.Close();
}

我将文件复制到我的网站项目中:

复制

C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319 文件夹和 粘贴到我的项目文件夹

【问题讨论】:

    标签: c# asp.net pdf webforms crystal-reports


    【解决方案1】:

    尝试检查浏览器的 JavaScript 控制台,看看是否存在与 CrystalReportViewer 相关的问题,缺少 js 引用 (*bobj is undefined*)。

    在这种情况下,请尝试将对crv.js 文件的脚本引用添加到您的打印页面(在您粘贴到项目中的文件夹中。我的位于4_0_30319/crystalreportviewers13/js/crviewer/crv.js

    【讨论】:

    • 检查了我的项目文件夹,crv.js文件存在
    • 尝试在页面中的 CrystalViewer 控件之前添加对该文件的脚本引用
    猜你喜欢
    • 2019-06-20
    • 1970-01-01
    • 2018-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多