ConvertLayoutFileToLayout

Résumé

References a layout file (.pagx) stored on disk.

Discussion

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.

Attention :

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.

Syntaxe

ConvertLayoutFileToLayout (layout_file)
ParamètreExplicationType de données
layout_file

A string that includes the full system path and file name of an existing layout file.

String
Valeur renvoyée
Type de donnéesExplication
Layout

The Layout object provides access to all page layout elements.

Exemple de code

ConvertLayoutFileToLayout example

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)