Hi again! I have tried to do this (I do not know if it is correct to get the name field labeled):
//I get the item in the Collection
IAnnotateLayerPropertiesCollection pAnnoLayerPropsColl = pGeoFLayer.getAnnotationProperties();
IAnnotateLayerProperties[] alpArray = new IAnnotateLayerProperties[10];
IElementCollection[] visibles = new IElementCollection[10];
IElementCollection[] invisibles = new IElementCollection[10];
pAnnoLayerPropsColl.queryItem(0, alpArray, visibles, invisibles);
//I get the text in the label
IElement[] pElement = new IElement[10];
ITextElement pTextElement;
int i = 0;
String sText;
for (i=0; i < visibles.length; i++){
visibles[0].queryItem(i, pElement, null);
pTextElement = (ITextElement) pElement[0];
sText = pTextElement.getText();
System.out.println(sText);
}
I guess sText has the name field, but when I run this, this show me the AutomationException:
AutomationException: 0x80070057 - The hook has not yet been set into the CommandPool in 'esriControls.CommandPool.1'
at com.esri.arcgis.carto.ElementCollection.queryItem(Unknown Source)
in the line: visibles[0].queryItem(i, pElement, null);I do not know what this mean, I really will appreciate your help, Thanks!