Hi there,
I'm new to Stimulsoft Reports.Net and I'm having difficulties with dynamic report building using existing templates.
What I want to do is the following:
I have a system (developed in VB.NET) and from a certain form I allow my users to select tables/columns from our database to include in the report.
Once the user selects the tables/columns he wants, he can specify any filtering options and also "order by" options. Then I generate the appropriate sql
statement and I execute it. This gives me a DataTable and finally I construct a DataSet which contains that DataTable.
I tried programmatically to create a new StiReport and add my DataSet to its Dictionary. I can then add some header/footer bands and of course a DataBand.
I loop through the user-selected tables/columns and I add the columns to the DataBand one next to the other (tabular report). This works fine.
This is part of my code:
Report = New StiReport()
Dim ds As DataSet = New DataSet("ds")
ds.Tables.Add(myDataTable)
Report.RegData("REPORT_DATA", ds)
Report.DataStore.RegData("REPORT_DATA", ds)
Report.Dictionary.Synchronize()
But this is not quite what I want to do. What I want is to have a set of predefined report templates and then allow the user to select a template
from a list of available templates. Once a template is selected (for example an .mrt file which contains a ReportTitle band, a PageHader band,
a PageFooter band, a Header band, a Footer band and a DataBand) I load the report template like so:
Report.Load(myReportTemplate & ".mrt")
I follow the same procedure as described above to add my datasource:
Dim ds As DataSet = New DataSet("ds")
ds.Tables.Add(myDataTable)
Report.RegData("REPORT_DATA", ds)
Report.DataStore.RegData("REPORT_DATA", ds)
Report.Dictionary.Synchronize()
Then I want to access the predefined bands and add programmatically my items on them. I would like that procedure to be done without launching the Designer.
I want my form to "load" the predefined report template, generate the dynamic data from our database and then add the data and the user options (report title,
page header titles etc) to the predefined template. Is that possible? And if so, can you please guide me through?
Thanx in advance!
Programmatically generating a report from existing template
Programmatically generating a report from existing template
Hi Demetris,
Please see the following sample applications from the standard trial installation of Stimulsoft Reports.Net:
c:\Program Files\Stimulsoft Reports.Net 2008.Trial\Samples\VB.Net\Print Table
c:\Program Files\Stimulsoft Reports.Net 2008.Trial\Samples\VB.Net\RuntimeBuildReport
Thank you.
Please see the following sample applications from the standard trial installation of Stimulsoft Reports.Net:
c:\Program Files\Stimulsoft Reports.Net 2008.Trial\Samples\VB.Net\Print Table
c:\Program Files\Stimulsoft Reports.Net 2008.Trial\Samples\VB.Net\RuntimeBuildReport
Thank you.