Using ArcPy (or ArcObjects if essential), is there a way to retrieve the rendered text of a text element that includes Dynamic Text?
The text property of the TextElement includes the Dynamic Text tags, but I would like to access the resolved text that will be displayed on the map.
For example for a title page at the moment:
myTextElement.text = "Country Map - Name: <dyn type="page" property="name"/> - Code: <dyn type="page" property="attribute" field="CNTR_ID"/>"
But I'd like to get the resolved dynamic text, in this example from a data driven page:
Country Map - Name: Zimbabwe - Code: ZW
This is to be able to export metadata for maps produced using data driven pages. At the moment without a method to access the resolved value of the dynamic text the only solutions we can think of are to either;
- Write a class to parse and resolve the dynamic text.
This wouldn't be too difficult to do as the datadriven page class includes a property to the index layer, but I expect running an attribute cursor for each page would slow exports down.
- Save the MXD for ArcMap 9.3 which doesn't support dynamic text (this strips the dynamic text from the layout and replaces it with it's values).
While this would work it seems a long way around, as after saving a copy the map document would then need to be opened to retrieve the text element value.