Zusammenfassung
References a layout file (.pagx) stored on disk.
Diskussion
In some workflows—for example, web map printing—it is useful to be able to reference a layout file (.pagx) and access its properties. For example, read the page size and query what elements are on the layout, such as legend, title text, copyright text, author text, custom text elements, and so on.
Vorsicht:
ConvertLayoutFileToLayout creates an in-memory project and therefore can't be used to import layouts into the current application or other existing projects. To do this, use the importDocument method on the ArcGISProject class instead.
Syntax
ConvertLayoutFileToLayout (layout_file)
Parameter | Erläuterung | Datentyp |
layout_file | A string that includes the full system path and file name of an existing layout file. | String |
Codebeispiel
In this example, the script reads a layout file (.pagx).
import arcpy
# The template location in the server data store
templatePath = '//MyMachine/MyDataStore/WebMap'
# Input Layout template
Layout_Template = "Landscape11x17"
# Get the requested template
template_pagx = os.path.join(templatePath, Layout_Template + '.pagx')
layout = arcpy.mp.ConvertLayoutFileToLayout(template_pagx)
print(layout.pageUnits)