ConvertLayoutFileToLayout

Resumen

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

Debate

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.

Precaución:

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.

Sintaxis

ConvertLayoutFileToLayout (layout_file)
ParámetroExplicaciónTipo de datos
layout_file

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

String
Valor de retorno
Tipo de datosExplicación
Layout

The Layout object provides access to all page layout elements.

Muestra de código

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)