Report Inheritance

Top  Previous  Next

 

There are two ways of report inheritance:

1. Creation of the basic class of a report;
2. Creation of the master-report.

 

In both ways you should create a basic report in the designer that includes all necessary elements. You may add the following components to the basic reports:

 

· Pages;
· Components;
· Data sources;
· Variables;
· Connections.

 

After the report has been created you may either save the report as a special basic class (for this you should use the Save as command) or save the report as a regular report and then use it as a master report.

In the first case, you will get the C# or VB.NET class, and will be able to create new reports. For example:

 

 

 

Reports.Report master = new Reports.Report();
master.RegData(dataSet);
master.Design();

 

 

In order to use the basic report when creating a new report in the designer, you need to add the following string of a code:

 

 

StiReport.ReportType = typeof(Reports.Report);

 

 

Then all new reports will be automatically inherited from the basic class.

In the second way you need to use the following code:

 

 

 

StiReport masterReport = new StiReport();

masterReport.Load("d:\\master-detail.mrt");

 

StiReport report = new StiReport();

report.RegData(dataSet);

                 

report.MasterReport = masterReport.SaveToString();

report.Design();

 

 

 

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)