Accessing and modifying subreports

A subreport is a Crystal report that is contained within a report. You can use subreports to present different views of the same data, or to report off data sources that could otherwise not be linked. A subreport has most of the characteristics of a main report, including its own data source, record selection formula, sections, and objects. It can use a data source that is linked to the main report or separate from the main report.
There are differences between a subreport and a main report:
  • A subreport cannot contain subreport objects.
  • Subreports do not have Page Header or Page Footer sections.
To work with subreports, you use the ISubreportClientDocument interface, which is similar to using the ReportClientDocument class to work with the main report. You can access controllers through the ISubreportClientDocument interface and use them to modify the definition of the subreport. Use the SubreportController of the main report to obtain the ISubreportClientDocument interface.
To place a subreport in the main report, use a SubreportObject. A SubreportObject is similar to other report objects, such as TextObject or FieldObject, but it contains a reference to the subreport definition. You can format the properties of a SubreportObject, such as the border style and background color. Setting these properties will affect how the subreport is displayed in the main report, without changing the structure or content of the subreport itself.