ConvertLayoutFileToLayout

サマリー

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

説明

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.

注意:

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.

構文

ConvertLayoutFileToLayout (layout_file)
パラメーター説明データ タイプ
layout_file

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

String
戻り値
データ タイプ説明
Layout

The Layout object provides access to all page layout elements.

コードのサンプル

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)