Textfile to Annotation

Last Modified:4/03/2001

This sample creates geodatabase annotation from a text input file. The input data should be in comma separated variable form as follows: X-coord,Y-coord,text,degrees_angle. The sample is deployed as a ArcCatalog command button.

The sample demonstrates how to create geodatabase annotation with ArcObjects. There are alternatives ways of importing annotation. For example, from the text file you could create an XY Event Layer, label the points in ArcMap and then convert the labels to annotation.

A feature dataset is required by the sample for simplicity. It ensures that a spatial reference already exists. The button is only enabled when a feature dataset is selected.

How to use:
  1. In the ArcCatalog Tools/Customize dialog, click on 'Add from file' and select this sample's dll.
  2. Under the Commands tab, select the Import Annotation command from the Developer Samples category, and drag it on to a toolbar. Dismiss the Customize dialog.
  3. Using ArcCatalog, open up the Developer Samples data USA geodatabase and select the 'General' feature dataset.
  4. Click on the command, a dialog will appear.
  5. Choose the State_labels text file in the Developer Samples data USA folder, then click OK
  6. A message box will appear when data conversion is complete. Use ArcCatalog to preview the new annotation feature class.


Requires: A feature dataset

Difficulty: Intermediate

Visual Basic
File Description
Text2Anno.bas VB module holding main data handling functions
clsText2AnnoUI.cls Class file that implements the command button
frmText2Anno.frm VB Form file holding the Import Dialog.
frmResources.frm VB Form file holding resources for the Class.
Text2AnnoSample.dll Compiled project DLL.
Text2AnnoSample.vbp Visual Basic project file.

Key CoClasses: TextElement, TextSymbol
Key Interfaces: IFeatureWorkspaceAnno, IFDOGraphicsLayer, IElementCollection, IGraphicsLayerScale, IObjectClassDescription, ITextElement, ITextSymbol, ITransform2D
Key Members: IFeatureWorkspaceAnno::CreateAnnotationClass, IFDOGraphicsLayer::DoAddElements