How to Concatinate two Report?

Stimulsoft Reports.NET discussion
Post Reply
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

How to Concatinate two Report?

Post by amitkaushik »

Hi,

I have more then one Reports and looking to display them with in the same UI dynamicly.

Thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to Concatinate two Report?

Post by HighAley »

Hello.

If you need to join reports you could use next code:
StiReport rep1 = new StiReport();
rep1.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report1.mrt");
rep1.Compile();
rep1.Render();

StiReport rep2 = new StiReport();
rep2.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report2.mrt");
rep2.Compile();
rep2.Render();

StiReport joinedReport = new StiReport();
joinedReport.SubReports.Add(rep1, false, true);
joinedReport.SubReports.Add(rep2, false, true);

joinedReport.Show();
Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: How to Concatinate two Report?

Post by amitkaushik »

Thanks, Code is good, but i have multiple function creates different-different mrt report accordingly in a defined order (Order change according to user request).

Here I need to append report according to that order.
Hope u get what I want to define.

Regards :)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to Concatinate two Report?

Post by HighAley »

Hello.

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: How to Concatinate two Report?

Post by amitkaushik »

Yes, I put your code in my application but the problem is, let have example;

stireport function1()
{
StiReport rep1 = new StiReport();
rep1.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report1.mrt");
rep1.Compile();
rep1.Render();

StiReport rep2 = new StiReport();
rep2.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report2.mrt");
rep2.Compile();
rep2.Render();

StiReport joinedReport = new StiReport();
joinedReport.SubReports.Add(rep1, false, true);
joinedReport.SubReports.Add(rep2, false, true);
return joinedReport ;
}

Function2()
{
StiReport rep3 = new StiReport();
rep3.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report3.mrt");
rep3.Compile();
rep3.Render();

StiReport FinaljoinedReport = new StiReport();
FinaljoinedReport.SubReports.Add(function1(), false, true);
FinaljoinedReport.SubReports.Add(rep3, false, true);

FinaljoinedReport.Show();
}

Here final report only show report generated with function1().
if i change the order like;

FinaljoinedReport.SubReports.Add(rep3, false, true);
FinaljoinedReport.SubReports.Add(function1(), false, true);

then it work fine.

thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to Concatinate two Report?

Post by HighAley »

Hello.

What's stopping you to add all sub-reports in one function?

Thank you.
Post Reply