Hi,
In a nut shell, If anyone knows how to change the text in legend labels in arcpy let me know.
This is what I have tried so far...
I am trying to edit the description of the layer using the layer.description method and then setting the legend item's style to one that uses the description as the primary legend label.
I can set the style property and when I print the layer's description to the terminal it appears to be set, however when I open the mxd, the description isn't filled out (under the symbology tab of the layer's properties).
Here's a sample of my code
I think that the layer property for description isn't what I think it is, but maybe somebody else knows what I am missing.
Thanks in advance!
In a nut shell, If anyone knows how to change the text in legend labels in arcpy let me know.
This is what I have tried so far...
I am trying to edit the description of the layer using the layer.description method and then setting the legend item's style to one that uses the description as the primary legend label.
I can set the style property and when I print the layer's description to the terminal it appears to be set, however when I open the mxd, the description isn't filled out (under the symbology tab of the layer's properties).
Here's a sample of my code
Code:
for item in mxdlist:
if ".mxd" in item:
figpath = path + item
mxd = arcpy.mapping.MapDocument(figpath)
for item in arcpy.mapping.ListLayers(mxd):
if "RIPRAP" in item.name:
item.description = 'Rip Rap'
print "....Updated"
print item.description
legend = arcpy.mapping.ListLayoutElements(mxd, "LEGEND_ELEMENT", "Legend")[0]
legendlayers = legend.listLegendItemLayers()
for item in legendlayers:
if "RIPRAP" in item.name:
style = arcpy.mapping.ListStyleItems("USER_STYLE", "Legend Items","blobDesc")[0]
legend.updateItem(item, style)
print item.name
mxd.save()
del mxd
Thanks in advance!