0

我的报告在 IIS 中成功生成,现在我想获得 PDF 格式的报告。请指导我 - 我在下面列出了我的来源:

 protected void Button1_Click(object sender, EventArgs e)
{
    ReportDocument rpt = new ReportDocument();
    rpt.Load(Server.MapPath("MR.rpt"));
    rpt.SetDatabaseLogon("", "", "RAMYA-BD", "");
    rpt.SetParameterValue("MRNO", ddlmrno.SelectedItem.Text);

    CrystalReportViewer1.ReportSource = rpt;
    Response.ContentType = "application/pdf";
}
4

2 回答 2

1

如果您没有添加查看器:

Stream st = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=\"xxx.pdf\"");
st.CopyStream(Response.OutputStream);
Response.Output.Flush();
Response.End();

数据库连接可能

rep.DataSourceConnections[0].SetLogon("Login","Password");
于 2013-04-25T09:21:17.973 回答