Sub Report/Report Pack

Stimulsoft Reports.NET discussion
Post Reply
Ink
Posts: 50
Joined: Sat Jul 02, 2011 2:26 am
Location: UK

Sub Report/Report Pack

Post by Ink »

Hi,

I have many single page reports which contain unrelated data from differnt sources. I would like to allow the user to combine them into one 'report pack', so that they may use the export functionality to produse a PDF file.
I know I can do this manually by creating seperate pages & data bands, but is there any way to embed existing reports inside another report? I have looked at the subreport function but am afraid I don't understand how to use it.

Regards,

Jon.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Sub Report/Report Pack

Post by Alex K. »

Hello,

For the Sub-Report component you can set the Page or another report. As a way, you can try to put several SubReport components on one page and set for it links on another reports.

Thank you.
Ink
Posts: 50
Joined: Sat Jul 02, 2011 2:26 am
Location: UK

Sub Report/Report Pack

Post by Ink »

Aleksey,

Thank you for the response. Could you please tell me how I do this? I can see the 'Use External Report' property, but cannot figure out how to set the report it uses.
Also, I will obviosuly need to do this in code at runtime. I will need to link each subreport to each main report and then set the datasource for each, as each main report has it's own Connection/Table.
Could you please give me a vb.net example of how to do this?

Many Thanks,

Jon.
Ink
Posts: 50
Joined: Sat Jul 02, 2011 2:26 am
Location: UK

Sub Report/Report Pack

Post by Ink »

Alesey,

Sorted it out. I use the following and it seems to work ok.

Dim ds As DataSet = New DataSet
Dim stiSub1 As New StiReport
Dim stiSub2 As New StiReport

Dim stiReportPack As New StiReport

With stiSub1
.Load(ReportPath & "\FirstReport.mrt")
.Dictionary.DataSources.Clear()
ds.ReadXmlSchema(ReportPath & "\FirstReport.xsd")
ds.ReadXml(ReportPath & "\FirstReport.xml")
.Dictionary.ImportXMLSchema(ds)
.RegData("Table", ds)
End With

With stiSub2
.Load(ReportPath & "\SecondReport.mrt")
.Dictionary.DataSources.Clear()
ds.ReadXmlSchema(ReportPath & "\SecondReport.xsd")
ds.ReadXml(ReportPath & "\SecondReport.xml")
.Dictionary.ImportXMLSchema(ds)
.RegData("Table", ds)
End With

With stiReportPack
.SubReports.Add(stiSub1)
.SubReports.Add(stiSub2)
.Render()
End With

Regards,

Jon.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Sub Report/Report Pack

Post by Andrew »

Hello,

Great!

Have a nice day!
Thank you.
Post Reply