The requested page is not available for the requested platform. You are viewing the content for Default platform.

XRSubreport Class

A Subreport control that is used to embed other reports in an XtraReport.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

[XRDesigner("DevExpress.XtraReports.Design.XRSubreportDesigner,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[ToolboxBitmap(typeof(XRSubreport))]
[ToolboxTabName("DX.18.2: Report Controls")]
[XRToolboxSubcategory(2, 4)]
[ToolboxBitmap24("DevExpress.XtraReports.Images.Toolbox24x24.XRSubreport.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[ToolboxBitmap32("DevExpress.XtraReports.Images.Toolbox32x32.XRSubreport.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[ToolboxSvgImage("DevExpress.XtraReports.SvgImages.Controls.XRSubreport.svg,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
public class XRSubreport :
    SubreportBase
<XRDesigner("DevExpress.XtraReports.Design.XRSubreportDesigner,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
<ToolboxBitmap(GetType(XRSubreport))>
<ToolboxTabName("DX.18.2: Report Controls")>
<XRToolboxSubcategory(2, 4)>
<ToolboxBitmap24("DevExpress.XtraReports.Images.Toolbox24x24.XRSubreport.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
<ToolboxBitmap32("DevExpress.XtraReports.Images.Toolbox32x32.XRSubreport.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
<ToolboxSvgImage("DevExpress.XtraReports.SvgImages.Controls.XRSubreport.svg,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
Public Class XRSubreport
    Inherits SubreportBase
    Implements

Remarks

By placing an XRSubreport instance onto your report, you can embed other reports into it (via the SubreportBase.ReportSource property), e.g. to create master-detail reports, side-by-side reports or prepare templates for reusing reports or their parts (headers or footers).

Within an MDI End-User Report Designer, if an end-user double-clicks an XRSubreport control, the report assigned to it is opened in a new Design Panel of the current Designer form.

Examples

This example illustrates the use of the XRSubreport control at runtime.

Not that at runtime, you can also assign a subreport by handling the XRControl.BeforePrint event of the XRSubreport control and setting its SubreportBase.ReportSource property.

using DevExpress.XtraReports.UI;
// ...

private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    ((XRSubreport)sender).ReportSource = new WindowsFormsApplication1.Reports.XtraReport3();
}

The following example demonstrates how to create a XRSubreport control and adjust some of its main properties (e.g. SubreportBase.ReportSource). This example assumes that an XtraReport object passed as a parameter to the CreateCompositeReport method, has already been created in the current project.

using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public XtraReport CreateCompositeReport(XtraReport detailReport) {
    // Create a report.
    XtraReport mainReport = new XtraReport();

    // Create a subreport.
    XRSubreport subreport = new XRSubreport();

    // Create a detail band and add it to the main report.
    DetailBand detailBand = new DetailBand();
    mainReport.Bands.Add(detailBand);

    // Set the subreport's location.
    subreport.Location = new Point(110, 100);

    // Specify a detail report as a report source for the subreport.
    subreport.ReportSource = detailReport;

    // Add the subreport to the detail band.
    detailBand.Controls.Add(subreport);

    return mainReport;
}

Implements

DevExpress.XtraReports.Serialization.IXRSerializable
DevExpress.Utils.Serializing.Helpers.IXtraSupportDeserializeCollectionItem
DevExpress.Utils.Serializing.IXtraSerializable
DevExpress.Utils.Serializing.Helpers.IXtraSupportCreateContentPropertyValue
DevExpress.XtraReports.Native.IComplexControl
See Also