AnsweredAssumed Answered

Setting ISymbolCollectionElement.Text throws exception

Question asked by tedrakel_power on Oct 5, 2018
Latest reply on Oct 8, 2018 by tedrakel_power

I'm using Arc GIS 10.2.1.  I'm trying to programmaticly update the text displayed in Arc Map for an annotation feature.  I can set the Bold and Underline properties and see the change in Arc Map.  However, when I try to update the Text property, I get an exception "Error HRESULT E_FAIL has been returned from a call to a COM component."  Here's the code where it throws :


// OCR_AnnoFC is the annotation feature class.  I want to update the text display for the feature with objectID = 25 

IFeature OCR_annoFeat = OCR_AnnoFC.GetFeature(25);

IAnnotationFeature anno = OCR_annoFeat as IAnnotationFeature;
ISymbolCollectionElement sce = anno.Annotation as ISymbolCollectionElement;
sce.Bold = sce.Underline = true;  
sce.Text = "test" ;  // <--- this statement throws the exception.  The error code is -2147467259