我想在代碼級別渲染大型的非圖形報告(數千頁),忽略了.rdlc文件中的僅僅阻塞瀏覽器的ReportViewer
控件。當我測試呈現一個有2000頁的報告時,Microsoft.Reporting.WebForms.LocalReport.Render
方法需要大約半小時才能完成,這被認爲是不好的用戶體驗。如何在代碼中從.rdlc導出PDF時提高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);
任何幫助非常感謝,謝謝提前!