MVC使用RDLC输出文件,为什么提示“本地报表处理期间出错”?
嫣如舜华 2013-07-30 05:31:51 public ActionResult AmbulancePersonSignReport(string startTime, string endTime)
{
SS s= new SS();
List<Ale> list = s.GetInfo(startTime, endTime);
var ReportPath = Server.MapPath("/RDLC/AmbulancePersonSign.rdlc");
var localReport = new Microsoft.Reporting.WebForms.LocalReport { ReportPath = ReportPath };
Microsoft.Reporting.WebForms.ReportParameter pStartTime = new Microsoft.Reporting.WebForms.ReportParameter("StartTime", startTime);
Microsoft.Reporting.WebForms.ReportParameter pEndTime = new Microsoft.Reporting.WebForms.ReportParameter("EndTime", endTime);
localReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { pStartTime, pEndTime });
var reportDataSource = new Microsoft.Reporting.WebForms.ReportDataSource("AmbulancePersonSignInfo", list);
localReport.DataSources.Add(reportDataSource);
string mimeType;
string encoding;
string fileNameExtension;
string reportType = "pdf";
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>" + reportType + "</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>1in</MarginLeft>" +
" <MarginRight>1in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
renderedBytes = localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings); (这段代码总报错:“本地报表处理期间出错”)
return File(renderedBytes, mimeType);
}