我想在代码级别呈现大型非图形报告(数千页),从 .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);
非常感谢任何帮助,提前致谢!
最佳答案
配售<trust legacyCasModel="true" level="Full"/>
里面<system.web>
在 web.config
中标记为我做的。 More details here
关于c# - 在代码中从 .rdlc 导出 PDF 时,如何提高 LocalReport.Render 方法的性能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7873003/