ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Reports Namespace / ReportDetails Class
Members Example

In This Topic
    ReportDetails Class
    In This Topic
    Represents a report details.
    Object Model
    ReportDetails ClassCoordinate2D StructureEnvelope ClassCIMElement ClassGeometry ClassIElementContainer Interface
    Syntax
    Example
    Zoom to specific location on Report view
    {
      //Note: On the QueuedTask
      var detailsSection = report.Elements.OfType<ReportSection>().FirstOrDefault().Elements.OfType<ReportDetails>().FirstOrDefault();
      var bounds = detailsSection.GetBounds();
      ReportView.Active.ZoomTo(bounds);
    }
    Get various Report sections
    {
      //Get the "ReportSection element"
      //ReportSectionElement contains the ReportHeader, ReportPageHeader, ReportDetails. ReportPageFooter, ReportFooter sections.
      var mainReportSection = report.Elements.OfType<ReportSection>().FirstOrDefault();
    
      //Get the ReportHeader
      var reportHeader = mainReportSection?.Elements.OfType<ReportHeader>().FirstOrDefault();
    
      //Get the ReportHeader
      var reportPageHeader = mainReportSection?.Elements.OfType<ReportPageHeader>().FirstOrDefault();
    
      //Get the "ReportDetails" within the ReportSectionElement. ReportDetails is where "fields" are.
      var reportDetailsSection = mainReportSection?.Elements.OfType<ReportDetails>().FirstOrDefault();
    
      //Get the ReportPageFooter
      var reportPageFooter = mainReportSection?.Elements.OfType<ReportPageFooter>().FirstOrDefault();
    
      //Get the ReportFooter
      var reportFooter = mainReportSection?.Elements.OfType<ReportFooter>().FirstOrDefault();
    }
    Select elements
    {
      //Get the "ReportSection element"
      //ReportSectionElement contains the ReportHeader, ReportPageHeader, ReportDetails. ReportPageFooter, ReportFooter sections.
      var mainReportSection = report.Elements.OfType<ReportSection>().FirstOrDefault();
    
      //ReportDetailsSection contains the "Fields"
      //Get the "ReportDetails" within the ReportSectionElement. ReportDetails is where "fields" are.
      var reportDetailsSection = mainReportSection?.Elements.OfType<ReportDetails>().FirstOrDefault();
    
      var elements = reportDetailsSection.Elements;
      reportDetailsSection.SelectElements(elements);
    }
    Create a new field in the report
    {
      //This is the gap between two fields
      double fieldIncrement = 0.9388875113593206276389;
      //On the QueuedTask
      //New field to add.
      var newReportField = new CIMReportField
      {
        Name = "POP1990",
        FieldOrder = 2,
      };
      //Get the "ReportSection element"				
      var mainReportSection = report.Elements.OfType<ReportSection>().FirstOrDefault();
      if (mainReportSection == null) return;
    
      //Get the "ReportDetails" within the ReportSectionElement. ReportDetails is where "fields" are.
      var reportDetailsSection = mainReportSection?.Elements.OfType<ReportDetails>().FirstOrDefault();
      if (reportDetailsSection == null) return;
    
      //Within ReportDetails find the envelope that encloses a field.
      //We get the first CIMParagraphTextGraphic in the collection so that we can add the new field next to it.					
      var lastFieldGraphic = reportDetailsSection.Elements.FirstOrDefault((r) =>
      {
        var gr = r as GraphicElement;
        if (gr == null) return false;
        return (gr.GetGraphic() is CIMParagraphTextGraphic ? true : false);
      });
      //Get the Envelope of the last field
      var graphicBounds = lastFieldGraphic.GetBounds();
    
      //Min and Max values of the envelope
      var xMinOfFieldEnvelope = graphicBounds.XMin;
      var yMinOfFieldEnvelope = graphicBounds.YMin;
    
      var xMaxOfFieldEnvelope = graphicBounds.XMax;
      var YMaxOfFieldEnvelope = graphicBounds.YMax;
      //create the new Envelope to be offset from the existing field
    
      MapPoint newMinPoint = MapPointBuilderEx.CreateMapPoint(xMinOfFieldEnvelope + fieldIncrement, yMinOfFieldEnvelope);
      MapPoint newMaxPoint = MapPointBuilderEx.CreateMapPoint(xMaxOfFieldEnvelope + fieldIncrement, YMaxOfFieldEnvelope);
      Envelope newFieldEnvelope = EnvelopeBuilderEx.CreateEnvelope(newMinPoint, newMaxPoint);
    
      //Create field
      GraphicElement fieldGraphic = ReportElementFactory.Instance.CreateFieldValueTextElement(reportDetailsSection, newFieldEnvelope, newReportField);
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Layouts.Element
             ArcGIS.Desktop.Layouts.GroupElement
                ArcGIS.Desktop.Reports.ReportSectionElement
                   ArcGIS.Desktop.Reports.ReportDetails

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also