Synthèse
The ReportLayoutSection object references a supplemental page in a report. It provides access to the URI property.
Discussion
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.
Propriétés
Propriété | Explication | Type de données |
name (Lecture et écriture) | 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 (Lecture seule) | 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 (Lecture et écriture) | The report layout section visibility. Set this to False to exclude the section when exporting to PDF. | Boolean |
URI (Lecture et écriture) | 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 |
Exemple de code
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
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
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
Vous avez un commentaire à formuler concernant cette rubrique ?