AnsweredAssumed Answered

ArcPy: Using lblclass expression to change font style and color

Question asked by martinscheiber on Oct 12, 2012
Latest reply on Oct 12, 2012 by Wayne_Whitley
I´m trying to label features of a dataset using ArcPy and the lblclass function. While commands like "VBNewline" and "Round" work pretty well, I´m not able to change colors or font style. An expression that works in ArcMap doesn´t work in the script. Could anyone help me out please? I´m using ArcGIS 10.0

Code that works:
#Adding Labels     layer = arcpy.mapping.ListLayers(mxd, "")[0]      if layer.supports("LABELCLASSES"):         for lblclass in layer.labelClasses:             lblclass.className = "Flaeche"             lblclass.expression = "[FID] & VBNewLine & Round([AREA_mm2],2)"         lblclass.showClassLabels = True     layer.showLabels = True     arcpy.RefreshActiveView() 

Code that works in ArcMap but not in ArcPy:
#Adding Labels layer = arcpy.mapping.ListLayers(mxd, "")[0]  if layer.supports("LABELCLASSES"):     for lblclass in layer.labelClasses:         lblclass.className = "Flaeche"         lblclass.expression = ""<CLR red='255' green='0' blue='0'>" & [FID] & VBNewLine & Round([AREA_mm2],2) & "</CLR>""     lblclass.showClassLabels = True layer.showLabels = True arcpy.RefreshActiveView()

Outcomes