ReportLayoutSection

Resumen

The ReportLayoutSection object references a supplemental page in a report. It provides access to the URI property.

Debate

An ArcGIS Pro report can contain multiple report layout sections. A report layout section is a supplemental page that references a layout. Report layout sections are accessed using the listSections method on the Report object. This returns a Python list of ReportSection and ReportLayoutSection objects. Each report layout section can be referenced by a unique name and have a REPORT_LAYOUT_SECTION type.

To change the source of a ReportLayoutSection, update the URI property.

To exclude a report layout section when you export the report, set the visible property to False.

Propiedades

PropiedadExplicaciónTipo de datos
name
(Lectura y escritura)

The report layout section's name. It is important that all report sections in a project have a unique name so they can be easily referenced by name.

String
type
(Sólo lectura)

The listSections method on the Report object returns both ReportSection and ReportLayoutSection objects. A report layout section has a REPORT_LAYOUT_SECTION type.

String
visible
(Lectura y escritura)

The report layout section visibility. Set this to False to exclude the section when exporting to PDF.

Boolean
URI
(Lectura y escritura)

The source for a report layout section is a layout in your project. The Universal Resource Indicator is the unique identifier for each layout and does not change.

String

Muestra de código

Report example 1

The following script gets all report layout sections in a report:

aprx = arcpy.mp.ArcGISProject(r"C:\DemoData\NationalParks.aprx")
report = aprx.listReports("National Parks Report")[0]
sections = [s.name for s in report.listSections() if s.type=="REPORT_LAYOUT_SECTION"] # Get list of report layout section names
for s in sections:
	print(s)
# Map Overview
# Table of Contents
# Credits
Report example 2

The following script sets a report layout section visibility to False:

aprx = arcpy.mp.ArcGISProject(r"C:\DemoData\NationalParks.aprx")
report = aprx.listReports("National Parks Report")[0]
section = report.listSections("Map Overview")[0] # Find the report layout section by name
section.visible = False
Report example 3

The following script sets the URI for a report layout section:

aprx = arcpy.mp.ArcGISProject(r"C:\DemoData\NationalParks.aprx")
report = aprx.listReports("National Parks Report")[0]
layout = aprx.listLayouts("Updated TOC")[0] # Get the replacement layout
section = report.listSections("Table of Contents")[0] # Get the report layout section
section.URI = layout.URI