Just wondering if we can read dynamic text in arcpy?
For example, assume we have a Text Element called myText
which contains a piece of dynamic text Map <dyn type="page" property="index"/>
. Reading this Text Element is as below:
text = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "myText")[0].text
text
is now a string of Map <dyn type="page" property="index"/>
which is not what I actually want. In ArcMap, this Text Element is showed as Map 1
, and this is the value I want for my text
variable.
Is there any simple way to achieve this with arcpy?
As suggested in Access resolved/rendered dynamic text from ArcPy or ArcObjects?, this can be done by either parsing the text (which is not easy to do properly) or saving the mxd to v9.3 (which would slow down the process and may pose a compatibility risk)
UPDATE 1
Decided to go ahead with parsing the text as the dynamic texts in my MXDs are not that complicated. Cannot afford the approach of saving the mxd to v9.3 due to the huge number of MXDs to deal with.
Anyway, any other suggestions are more than welcome.