I work with multi MXD, and the title in all of them start with "The plan on the" and then i write the map's subject, for example:
"The plan on the land use", etc. I need to change just the sentence from "The plan on the" into "The blueprint on the". All other words in the title will remain the same. I try using this code:
import arcpy
from arcpy import env
env.workspace = r"D:\desktop\Project"
for mxdname in arcpy.ListFiles("*.mxd"):
print mxdname
mxd = arcpy.mapping.MapDocument(r"D:\desktop\Project\\" + mxdname)
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if elm.text == 'The plan on the*':
elm.text = 'The blueprint on the*'
print 'elm.text'
mxd.save()
del mxd
but it only print the MXD name:
>>>
airplane noise.mxd
airplane noise2 a3.mxd
antiquities.mxd
conflicts.mxd
project.mxd
>>>
No comments:
Post a Comment