I want to generate two reports in a single file that when i run my code show a file that have two page (first page was my first report and next page was my secound report) .
how can i do it ?
public ActionResult GetReport(Guid? productionId){
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Reports/ElementProduction.mrt"));
report.Load(Server.MapPath("~/Reports/ElementProduction2.mrt"));
return StiMvcViewer.GetReportResult(report);
}
public ActionResult GetReport(Guid? productionId){
report.Load(Server.MapPath("~/Reports/ElementProduction1.mrt"));
StiReport report = new StiReport();
report.Compile();
report.Render();
StiReport report2 = new StiReport();
report.Load(Server.MapPath("~/Reports/ElementProduction2.mrt"));
report2.Compile();
report2.Render();
StiReport joinedReport = new StiReport();
joinedReport.NeedsCompiling = false;
joinedReport.IsRendered = true;
joinedReport.RenderedPages.Clear();
foreach (StiPage page in report1.CompiledReport.RenderedPages)
{
page.Report = joinedReport;
page.NewGuid();
joinedReport.RenderedPages.Add(page);
}
foreach (StiPage page in report2.CompiledReport.RenderedPages)
{
page.Report = joinedReport;
page.NewGuid();
joinedReport.RenderedPages.Add(page);
}
return StiMvcViewer.GetReportResult(joinedReport);