HOW TO
Instructions provided describe how to determine which symbol properties are overridden in the annotation feature class by using VBA code. The code displays the overridden values in the VBA immediate window.
The Override field in a 9.x annotation feature class is a uneditable field that is maintained by ArcGIS. When the override value is 0, the annotation feature displays using the SymbolID text symbol that it references and no display properties are stored in the record. When the override value is greater than 0, the annotation feature uses the SymbolID text symbol as a base display and applies the overridden properties to that symbol.
If the annotation feature does not reference a symbol in the symbol collection, the override value will always be 0 and the value of the SymbolID field for the feature will be -1. See the table below for a list of these possible values. The values that are seen in the attribute table are a sum of these values:
Override value Overridden property 1 XOffset property 2 YOffset property 4 Horizontal Alignment property 8 Vertical Alignment property 16 Flip Angle property 64 Size property 128 Color property 512 Character Spacing property 1024 Character Width property 2048 Word Spacing property 4096 Leading property 8192 Bold property 16384 Italic property 32768 Underline property 65536 Background Symbol 131072 Font propertyFor example, if the override value is 65, then both the XOffset (1) and Size (64) properties are overridden (1+64=65).
Note: Code in the Project's ThisDocument code module only runs in the current map document. To store the code in all map documents, open the Normal.mxt ThisDocument code module instead.
Code: Public Sub GetFeatureandReportOverrides() Dim pMxDoc As IMxDocument Dim pFL As IFeatureLayer Dim pFeature As IFeature Dim pAnnoFeat As IAnnotationFeature Dim pElement As IElement Dim pSymbolCollectionElement As ISymbolCollectionElement Dim pQF As IQueryFilter Dim pFeatureCursor As IFeatureCursor Dim OID As Long Set pMxDoc = ThisDocument Set pFL = pMxDoc.ActiveView.FocusMap.Layer(0) If TypeOf pFL Is IAnnotationLayer Then Set pFeatureCursor = pFL.Search(pQF, False) Set pFeature = pFeatureCursor.NextFeature Do Until pFeature Is Nothing OID = pFeature.OID Set pAnnoFeat = pFeature Set pElement = pAnnoFeat.Annotation If TypeOf pElement Is ISymbolCollectionElement Then Set pSymbolCollectionElement = pElement If pSymbolCollectionElement.SymbolID = -1 Then Debug.Print "Feature " & OID & " does not reference a symbol in the symbol collection" Else ReportOverrides OID, pSymbolCollectionElement.OverriddenProperties End If Else Debug.Print "Feature " & OID & " is not a text element" End If Set pFeature = pFeatureCursor.NextFeature Loop Else Debug.Print "The first layer in the map is not a Geodatabase Annotation layer" End If End Sub Public Sub ReportOverrides(OID As Long, lngOverrideVal As Long) Debug.Print "Feature " & OID & " has the following overrides:" 'lookup the overrides If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideXOffset) <= lngOverrideVal Then _ Debug.Print "X Offset" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideYOffset) <= lngOverrideVal Then _ Debug.Print "YOffset" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideHorzAlignment) <= lngOverrideVal Then _ Debug.Print "Horizontal Alignment" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideVertAlignment) <= lngOverrideVal Then _ Debug.Print "Vertical Alignment" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideFlipAngle) <= lngOverrideVal Then _ Debug.Print "Flip Angle" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideSize) <= lngOverrideVal Then _ Debug.Print "Size" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideColor) <= lngOverrideVal Then _ Debug.Print "Color" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideCharSpacing) <= lngOverrideVal Then _ Debug.Print "Character Spacing" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideCharWidth) <= lngOverrideVal Then _ Debug.Print "Character Width" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideWordSpacing) <= lngOverrideVal Then _ Debug.Print "Word Spacing" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideLeading) <= lngOverrideVal Then _ Debug.Print "Leading" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideBold) <= lngOverrideVal Then _ Debug.Print "Bold" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideItalic) <= lngOverrideVal Then _ Debug.Print "Italic" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideUnderline) <= lngOverrideVal Then _ Debug.Print "Underline" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideBackground) <= lngOverrideVal Then _ Debug.Print "Background" If (lngOverrideVal Xor esriSymbolOverrideEnum.esriSymbolOverrideFontName) <= lngOverrideVal Then _ Debug.Print "Font Name" Debug.Print " " 'a space for formatting End Sub
Get help from ArcGIS experts
Download the Esri Support App