ActiveReports Developer 7
SubReport (Section Report)
See Also Support Forum
ActiveReports Developer 7 > ActiveReports Developer Guide > Concepts > Section Report Concepts > Section Report Toolbox > SubReport (Section Report)

Glossary Item Box

In section reports, you can use the SubReport control to embed a report into another report. Once you place the Subreport control on a report, use code to create an instance of the report you want to load in it, and to attach the report object to the SubReport.

You can also pass parameters to the subreport from the main report so that data related to the main report displays in each instance of the subreport.

When to use a subreport

Due to the high overhead of running a second report and embedding it in the first, it is generally best to consider whether you need to use subreports. Some good reasons to use subreports include:

Remove page-dependent features from reports to be used as subreports

Subreports are disconnected from any concept of a printed page because they render inside the main report. For this reason, page-dependent features are not supported for use in subreports. Keep any such logic in the main report. Page-related concepts that are not supported in subreports include:

Coding best practices

Use the ReportStart event of the main report to create an instance of the report for your SubReport control, and then dispose of it in the ReportEnd event. This way, you are creating only one subreport instance when you run the main report.

In the Format event of the containing section, use the Report property of the SubReport control to attach a report object to the SubReport control. 

Caution: It is not a recommended practice to initialize the subreport in the Format event. Doing so creates a new instance of the subreport each time the section processes. This consumes a lot of memory and processing time, especially in a report that processes a large amount of data.

ShowImportant Properties

Property Description
CanGrow Determines whether ActiveReports increases the height of the control based on its content.
CanShrink Determines whether ActiveReports decreases the height of the control based on its value.
CloseBorder By default, the bottom border of the control does not render until the end of the subreport. Set this property to True to have it render at the bottom of each page. (Only available in code.)
Report Attaches a report object to the control. (Only available in code.)

SubReport Dialog

With the control selected on the report, in the Commands section at the bottom of the Properties window, you can click the Property dialog command to open the dialog.


Name: Enter a name for the SubReport that is unique within the report. This name is displayed in the Document Outline and in XML exports.

Tag: Enter a string that you want to persist with the control. If you access this property in code, it is an object, but in the Properties window or Property dialog, it is a string.

Visible: Clear this check box to hide the control.

ReportName: This property is not used by ActiveReports, but you can use it to store the path or relative path to an RPX report file that you want to load into a generic report instance in code.


Textbox height

Can increase to accommodate contents: Clear this check box to set CanGrow to False.

Can decrease to accommodate contents: Clear this check box to set CanShrink to False.

See Also

©2014. ComponentOne, a division of GrapeCity. All rights reserved.