Add new Text Element to Map Document using arcpy

08-16-2013 03:16 PM
Status: Open
Labels (1)
Occasional Contributor
It would be useful to be able to programatically add new Text Elements to Map documents using arcpy.

Ex: For map templates, add Text Element with size of map, then Make Thumbnail, followed by deleting the newly createdText Element with map size and finally save the map.  This would allow users to see the map size on map templates similar to those that Esri provides.
1 Comment
I agree there should be some easier way of adding new TextElements but you can "add" new elements by cloning them. This relies on a text element existing in the layout which you clone from. Its a bit of a fudgeso it would much nicer to see some sort of method that allows you to add elements.

# Create a clone of all text elements and set the text to FRED
mxd = arcpy.mapping.MapDocument("CURRENT")
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
  x = elm.clone()
  x.text = "FRED"