ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Reports Namespace / Report Class / AddSubReport Method
The subreport item.
Position to add subreport. If -1, the subreport is added to the end of the report. If 0, the subreport is added to the beginning of the report.
Adjust the size of the subreport to match main report.
Example

In This Topic
    AddSubReport Method
    In This Topic
    Adds a subreport to the report. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void AddSubReport( 
       Item reportItem,
       int insertIndex,
       bool adjustPageSize
    )
    Public Sub AddSubReport( _
       ByVal reportItem As Item, _
       ByVal insertIndex As Integer, _
       ByVal adjustPageSize As Boolean _
    ) 

    Parameters

    reportItem
    The subreport item.
    insertIndex
    Position to add subreport. If -1, the subreport is added to the end of the report. If 0, the subreport is added to the beginning of the report.
    adjustPageSize
    Adjust the size of the subreport to match main report.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    The reportItem is invalid.
    Example
    Add SubReport
    //Note: Call within QueuedTask.Run()
    var mainReport = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(r => r.Name == "USAReports")?.GetReport();
    
    if (mainReport == null) return;
    //Add sub report
    var vermontReportItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(r => r.Name == "Vermont");
    if (vermontReportItem == null) return;
    Report vermontReport = vermontReportItem.GetReport();
    mainReport.AddSubReport(vermontReportItem, -1, true); //  If -1, the subreport is added to the end of the report.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also