加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何在代码中从.rdlc导出PDF时,如何提高LocalReport.Rende

发布时间:2020-12-15 06:45:25 所属栏目:百科 来源:网络整理
导读:我想在代码级别渲染大型非图形化报告(数千页),省略从.rdlc文件中抓住浏览器的ReportViewer控件.当我测试呈现2000页的报表时,Microsoft.Reporting.WebForms.LocalReport.Render方法大约需要半小时才能完成,这被认为是糟糕的用户体验. 有没有任何技巧或替代解
我想在代码级别渲染大型非图形化报告(数千页),省略从.rdlc文件中抓住浏览器的ReportViewer控件.当我测试呈现2000页的报表时,Microsoft.Reporting.WebForms.LocalReport.Render方法大约需要半小时才能完成,这被认为是糟糕的用户体验.

有没有任何技巧或替代解决方案来提高渲染的性能:在代码中,重新设计.rdlc文件或其他地方,例如只是增加硬件?

示例代码:

LocalReport localReport = new LocalReport();
localReport.ReportPath = Server.MapPath("~/report.rdlc");

SetDataSources(ref localReport);

string reportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;

string deviceInfo =
"<DeviceInfo>" +
"  <OutputFormat>PDF</OutputFormat>" +
"  <PageWidth>8.5in</PageWidth>" +
"  <PageHeight>11in</PageHeight>" +
"  <MarginTop>0in</MarginTop>" +
"  <MarginLeft>0in</MarginLeft>" +
"  <MarginRight>0in</MarginRight>" +
"  <MarginBottom>0in</MarginBottom>" +
"</DeviceInfo>";
}

Warning[] warnings;
string[] streams;
byte[] renderedBytes;

//Render the report
renderedBytes = localReport.Render(
            reportType,deviceInfo,out mimeType,out encoding,out fileNameExtension,out streams,out warnings);

任何帮助非常感谢,谢谢提前!

解决方法

将datatable作为数据源返回的运行速度比对象列表快得多

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读