load multi report together

Stimulsoft Reports.NET discussion
Post Reply
SARA.SANI
Posts: 3
Joined: Sun Nov 22, 2015 7:59 pm

load multi report together

Post 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.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: load multi report together

Post 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.
Post Reply