Page 1 of 1
load multi report together
Posted: Wed Apr 05, 2017 7:52 pm
by SARA.SANI
Hi.
Is it possible Load multi of stimul files like .MRT and show together?
for example i made 1.mrt and 2 mart
i want to make a button and when i click button1 load and show 1.mrt & 2 mart Continuous in one Viewer of stimul .
Thanks in advance.
Re: load multi report together
Posted: Thu Apr 06, 2017 1:14 am
by Ivan
Hello,
As one of the solutions, you can join together two rendered reports and then show it in the viewer.
You can use the following code, for example:
Code: Select all
// Open and render first report
StiReport sourceReport = new StiReport();
sourceReport.Load(@"d:\Report1.mrt");
sourceReport.Compile();
sourceReport.Render();
// Open and render second report
StiReport sourceReport2 = new StiReport();
sourceReport2.Load(@"d:\Report2.mrt");
sourceReport2.Compile();
sourceReport2.Render();
// Now create report and copy rendered page from the reports
StiReport report = new StiReport();
report.NeedsCompiling = false;
report.IsRendered = true;
Stimulsoft.Report.Units.StiUnit newUnit = Stimulsoft.Report.Units.StiUnit.GetUnitFromReportUnit(report.ReportUnit);
report.RenderedPages.Clear();
foreach (StiPage page in sourceReport.CompiledReport.RenderedPages)
{
page.Report = report;
page.NewGuid();
Stimulsoft.Report.Units.StiUnit oldUnit = Stimulsoft.Report.Units.StiUnit.GetUnitFromReportUnit(sourceReport.ReportUnit);
if (report.ReportUnit != sourceReport.ReportUnit) page.Convert(oldUnit, newUnit);
report.RenderedPages.Add(page);
}
foreach (StiPage page in sourceReport2.CompiledReport.RenderedPages)
{
page.Report = report;
page.NewGuid();
Stimulsoft.Report.Units.StiUnit oldUnit = Stimulsoft.Report.Units.StiUnit.GetUnitFromReportUnit(sourceReport2.ReportUnit);
if (report.ReportUnit != sourceReport2.ReportUnit) page.Convert(oldUnit, newUnit);
report.RenderedPages.Add(page);
}
report.Show();
Thank you.