在代码中从.rdlc导出PDF时,如何提高LocalReport.Render方法的性能?

ans*_*ssi 10 c# pdf rendering reportviewer localreport

我想在代码级别渲染大的非图形报告(数千页),省略了ReportViewer从.rdlc文件中阻塞浏览器的控件.当我测试渲染一个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);
Run Code Online (Sandbox Code Playgroud)

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

DkD*_*Dev 0

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