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.v19.2.dll

Declaration

[SRCategory(ReportStringId.CatData)]
public XtraReport ReportSource { get; set; }
<SRCategory(ReportStringId.CatData)>
Public Property ReportSource As XtraReport

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 a subreport to the main report's DetailBand.
mainReport.Bands["DetailBand"].Controls.Add(subreport);
// Reference the "detailReport" XtraReport instance.
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)
    });
}
See Also