ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMMargin Class
Members Example

In This Topic
    CIMMargin Class
    In This Topic
    Represents a margin to apply around the page.
    Object Model
    CIMMargin ClassCIMMargin ClassCIMMargin Class
    Syntax
    Example
    Presentation page design
    // create customized margin and color 
    CIMMargin pMargin = new CIMMargin() { Left = 0.2, Right = 0.3, Top = 0.15, Bottom = 0.25 };
    CIMRGBColor pColor = new CIMRGBColor() { R = 255, G = 255, B = 0, Alpha = 50 };
    
    //Reference a page and its transition 
    var page = activePresentationView.Presentation.GetPage(0);
    CIMPresentationTransition transition = page.Transition;
    
    // update the transition style
    transition.TransitionType = PresentationTransitionType.Swipe;
    transition.Duration = 2.0;
    transition.SwipeDirection = SwipeDirection.Top;
    
    //Must be on the QueuedTask
    await QueuedTask.Run(() =>
    {
      //Set the new margin, new background color and new transition effect
      page.SetMargin(pMargin);
      page.SetBackgroundColor(pColor);
      page.SetTransition(transition);
    });
    Presentation page design
    // create customized margin and color 
    CIMMargin pMargin = new CIMMargin() { Left = 0.2, Right = 0.3, Top = 0.15, Bottom = 0.25 };
    CIMRGBColor pColor = new CIMRGBColor() { R = 255, G = 255, B = 0, Alpha = 50 };
    
    //Reference a page and its transition 
    var page = activePresentationView.Presentation.GetPage(0);
    CIMPresentationTransition transition = page.Transition;
    
    // update the transition style
    transition.TransitionType = PresentationTransitionType.Swipe;
    transition.Duration = 2.0;
    transition.SwipeDirection = SwipeDirection.Top;
    
    //Must be on the QueuedTask
    await QueuedTask.Run(() =>
    {
      //Set the new margin, new background color and new transition effect
      page.SetMargin(pMargin);
      page.SetBackgroundColor(pColor);
      page.SetTransition(transition);
    });
    Create report
    //Note: Call within QueuedTask.Run()
    //The fields in the datasource used for the report
    //This uses a US Cities dataset
    var listFields = new List<CIMReportField> {
              //Grouping should be the first field
              new CIMReportField{Name = "STATE_NAME", FieldOrder = 0, Group = true, SortInfo = FieldSortInfo.Desc}, //Group cities using STATES
              new CIMReportField{Name = "CITY_NAME", FieldOrder = 1},
              new CIMReportField{Name = "POP1990", FieldOrder = 2, },
          };
    //Definition query to use for the data source
    var defQuery = "STATE_NAME LIKE 'C%'";
    //Define the Datasource
    var reportDataSource = new ReportDataSource(featureLayer, defQuery, listFields);
    //The CIMPage defintion - page size, units, etc
    var cimReportPage = new CIMPage
    {
      Height = 11,
      StretchElements = false,
      Width = 6.5,
      ShowRulers = true,
      ShowGuides = true,
      Margin = new CIMMargin { Bottom = 1, Left = 1, Right = 1, Top = 1 },
      Units = LinearUnit.Inches
    };
    
    //Report template
    var reportTemplates = await ReportTemplateManager.GetTemplatesAsync();
    var reportTemplate = reportTemplates.Where(r => r.Name == "Attribute List with Grouping").First();
    
    //Report Styling
    var reportStyles = await ReportStylingManager.GetStylingsAsync();
    var reportStyle = reportStyles.Where(s => s == "Cool Tones").First();
    
    //Field Statistics
    var fieldStatisticsList = new List<ReportFieldStatistic> {
              new ReportFieldStatistic{ Field = "POP1990", Statistic = FieldStatisticsFlag.Sum}
              //Note: NoStatistics option for FieldStatisticsFlag is not supported.
          };
    var report = ReportFactory.Instance.CreateReport("USAReport", reportDataSource, cimReportPage, fieldStatisticsList, reportTemplate, reportStyle);
    Modify the report Page
    //Note: Call within QueuedTask.Run()
    var cimReportPage = new CIMPage
    {
      Height = 12,
      StretchElements = false,
      Width = 6.5,
      ShowRulers = true,
      ShowGuides = true,
      Margin = new CIMMargin { Bottom = 1, Left = 1, Right = 1, Top = 1 },
      Units = LinearUnit.Inches
    };
    report.SetPage(cimReportPage);
    //Change only the report's page height
    report.SetPageHeight(12);
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMMargin

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also