Skip to main content
A newer version of this page is available. .

SubreportBase.ReportSource Property

Gets or sets an XtraReport class instance. The instance’s content is included in the main report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.2.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

[SRCategory(ReportStringId.CatData)]
public XtraReport ReportSource { get; set; }

Property Value

Type Description
XtraReport

An XtraReport class instance.

Remarks

Rebuild the solution at design time after you declare an XtraReport class to be able to reference this class in the XRSubreport‘s ReportSource property.

Note

The ReportSource property is not available in Web Report Designer.

Use the ReportSourceUrl property instead of ReportSource to reference a report that is stored in a report definition (REPX) or XML file.

The ReportSourceUrl property value takes precedence over the ReportSource value. If you specify both properties, the XRSubreport includes the content from the report specified by ReportSourceUrl.

See XRSubreport for more information.

Examples

The code sample below adds an XRSubreport item to the report and uses the ReportSource property to reference a detail report.

Tip

Online Example: Use Subreports to Add a Chart

using System.IO;
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
XRSubreport subreport = new XRSubreport() {
    BoundsF = new RectangleF(0, 100, 550, 25),
};
// "mainReport" is an XtraReport instance.
// Add subreport to the main report's DetailBand.
mainReport.Bands["DetailBand"].Controls.Add(subreport);
// Reference an XtraReport instance named "detailReport" to include its content into the main report.
subreport.ReportSource = detailReport;

The code sample below handles the XRSubreport.BeforePrint event to add an XRLabel control to the referenced report’s instance.

using DevExpress.XtraReports.UI;
// ...
private void Subreport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    XRSubreport subreport = (XRSubreport)sender;
    XtraReport report = subreport.ReportSource;
    report.Bands["DetailBand"].Controls.Add(new XRLabel() {
        Text = " - ",
        BoundsF = new RectangleF(450, 0, 100, 25),
        Font = new Font(new FontFamily("Arial"), 9)
    });
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the ReportSource property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also