根据ActiveReports 9安装目录:ComponentOne Samples\ActiveReports 9\Professional\ActiveReportsWithMVC
下的事例
public ActionResult GetReport(ReportDescriptor reportdesc)
{
object report = null;
switch (reportdesc.Type)
{
case "Section":
report = new OrderReport {DataSource= Repository.GetOrders(reportdesc.Id) };
break;
case "age":
_reportdata = Repository.GetDetails(reportdesc.Id);
report = new PageReport(new FileInfo(Server.MapPath("~/Reports/OrderDetailsReport.rdlx")));
((PageReport)(report)).Document.LocateDataSource += Document_LocateDataSource;
break;
}
ViewBag.Report = report;
return PartialView("WebViewer");
}
可以处理基于代码的区域报表和页面报表list<object>数据载入,
但无法处理基于xml的区域报表
我的方法如下:
SectionReport aa = new SectionReport();
aa.DataSource = _ndkhjgService.testList2();
aa.Document.Load(Server.MapPath("~/Reports/" + reportName + ".rpx")); //提示该语句错误:文件格式不正确
report = aa; |