[英]report viewer control exporting content to pdf
我正在为客户创建asp.net网络应用程序,他喜欢在他的页面上有报告,所以我在页面rdlc文件上,我使用默认的asp.net报表查看器控件在页面上显示此文件...一切都是好的,除非客户端想要将文件保存为pdf时页面的结构发生变化并且看起来不一样我也注意到字段中的某些值为空但它们出现在页面上并且当我保存相同的报告时在Word(*。doc)格式中,单词文件也应该是......问题仅在于pdf。 欢迎任何建议
问题是由于报告属性中的边距设置,如果您遇到相同的问题,请将边距设置(左,右,上,下)设置为0in。 而你的问题就解决了。
试试这个代码....它将有助于以pdf格式显示你的数据
protected void submit_Click(object sender, EventArgs e)
{
bindReportData();
try
{
// Export the Report to Response stream in PDF format and file name Customers
abc_reportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "ABC");
// There are other format options available such as Word, Excel, CVS, and HTML in the ExportFormatType Enum given by crystal reports
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
ex = null;
}
}
private void bindReportData()
{
abc_reportDocument = new ReportDocument();
dsReport = new DataSet();
dsReport = getAccumulationData();
if (dsReport.Tables[0].Rows.Count > 0)
{
abc_reportDocument.Load(this.MapPath("report1.rpt"));
abc_reportDocument.Database.Tables[0].SetDataSource(dsReport.Tables[0]);
rptviewerAccumulation.ReportSource = abc_reportDocument;
rptviewerAccumulation.DataBind();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.