Back to Devexpress

SubreportBase.GenerateOwnPages Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-subreportbase-4e21bdbc.md

latest5.0 KB
Original Source

SubreportBase.GenerateOwnPages Property

Gets or sets whether the referenced report is printed on separate pages and uses its own page settings.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue(false)]
[SRCategory(ReportStringId.CatBehavior)]
public bool GenerateOwnPages { get; set; }
vb
<SRCategory(ReportStringId.CatBehavior)>
<DefaultValue(False)>
Public Property GenerateOwnPages As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if the referenced report is printed on separate pages and uses its own page settings; false if the referenced report uses the main report’s pages and page settings.

|

Remarks

Set the GenerateOwnPages property of the XRSubreport control to true to specify that the report referenced in the subreport control generates its own pages and has its own page size, margins, and orientation.

The GenerateOwnPages property is not in effect if you place the XRSubreport control in the following bands:

Tips and Limitations

If you enable the GenerateOwnPages option, the main report’s page footer will not be displayed on the subreport pages. To continue page numbering on subreport pages, add the PageFooterBand to the subreport and place the XRPageInfo control onto that band.

Example

The following code snippet adds an XRSubreport to the report and uses the ReportSourceUrl property to reference the detail report. The code also sets the GenerateOwnPages property value to true to specify that the referenced report uses its own page settings.

View Example: Use Subreports to Add a Chart

csharp
using System.IO;
using System.Drawing;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Parameters;
// ...
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 a report from the report definition (REPX) file. The file is stored in the application's folder.
subreport.ReportSourceUrl = Path.Combine(Path.GetDirectoryName(typeof(ReportCreator).Assembly.Location), "DetailReport.repx");
// Specify that the referenced report uses its own page settings.
subreport.GenerateOwnPages = true;
vb
Imports System.IO
Imports System.Drawing
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.Parameters
' ...
Dim subreport As New XRSubreport() With {.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 a report from the report definition (REPX) file. The file is stored in the application's folder.
subreport.ReportSourceUrl = Path.Combine(Path.GetDirectoryName(GetType(ReportCreator).Assembly.Location), "DetailReport.repx")
' Specify that the referenced report uses its own page settings.
subreport.GenerateOwnPages = True

See Also

SubreportBase Class

SubreportBase Members

DevExpress.XtraReports.UI Namespace