ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Reports Namespace / ReportProjectItem Class
Members Example

In This Topic
    ReportProjectItem Class
    In This Topic
    Represents a report project item.
    Object Model
    ReportProjectItem ClassReport ClassTimeInstant Class
    Syntax
    public sealed class ReportProjectItem : ArcGIS.Desktop.Internal.Core.ProjectItem, ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, System.ComponentModel.INotifyPropertyChanged  
    Public NotInheritable Class ReportProjectItem 
       Inherits ArcGIS.Desktop.Internal.Core.ProjectItem
       Implements ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, System.ComponentModel.INotifyPropertyChanged 
    Remarks

    Each Report in a project is associated with a ReportProjectItem. This item contains numerous read-only metadata properties about the report. Although a report may exist in the project, it may not be loaded (an open report view). To reference the actual report and ensure it is loaded into memory, you must use the GetReport method.

    Example
    Gets all the reports in the current project
    var projectReports = Project.Current.GetItems<ReportProjectItem>();
    foreach (var reportItem in projectReports)
    {
      //Do Something with the report
    }
    Get a specific report
    ReportProjectItem reportProjItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals(reportName));
    Report report = reportProjItem?.GetReport();
    Open a Report project item in a new view
    //Open a report project item in a new view.
    //A report project item may exist but it may not be open in a view. 
    
    //Reference a report project item by name
    ReportProjectItem reportPrjItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals("MyReport"));
    
    //Get the report associated with the report project item
    Report reportToOpen = await QueuedTask.Run(() => reportPrjItem.GetReport());
    
    //Create the new pane
    IReportPane iNewReporttPane = await ProApp.Panes.CreateReportPaneAsync(reportToOpen); //GUI thread
    Activate an already open report view
    Report report = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault().GetReport();
    var reportPane = FrameworkApplication.Panes.FindReportPanes(report).Last();
    if (reportPane == null)
      return;
    //Activate the pane
    (reportPane as ArcGIS.Desktop.Framework.Contracts.Pane).Activate();
    //Get the "ReportView" associated with the Report Pane.
    ReportView reportView = reportPane.ReportView;
    Delete a report
    //Note: Call within QueuedTask.Run()
    //Reference a reportitem in a project by name
    ReportProjectItem reportItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals(reportName));
    
    //Check for report item
    if (reportItem == null)
      return Task.FromResult<bool>(false);
    
    //Delete the report from the project
    return Task.FromResult<bool>(Project.Current.RemoveItem(reportItem));
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Core.Item
                ArcGIS.Desktop.Reports.ReportProjectItem

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also