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));
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.