Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to update a Text_Element with a newline or page break. Does anyone know the tag or syntax? Thanks.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The second example in the online help demonstrates how to add the newline to a text element.

share|improve this answer
Thanks Dan. I was trying /n and <br/> and all that stuff. Your suggestion worked. –  Justin Feb 23 '12 at 15:44
add comment

Dan is correct (and answered before me), but I had to try this myself, as I assumed that there was no way that a \n would work (that would be too easy!)

I made a textbox, named it "Text", added some text:

enter image description here

Ran this code that Dan points to:

>>> import arcpy
>>> mxd = arcpy.mapping.MapDocument("CURRENT")
>>> elm = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "Text")[0]
>>> elm.text = 'Date: <dyn type="date" format="short"/> \nTime: <dyn type="time" format=""/>'
>>> arcpy.RefreshActiveView()

And got this:

enter image description here

Also, this seems to only work programmatically; adding a \n in the textbox in ArcMap only outputs the \n as text.

share|improve this answer
You should use \r\n instead of just \n, otherwise it can cause TextElements to bug out. See this question I asked a few months ago. –  dmahr Feb 23 '12 at 15:28
@dmahr - Interesting, thanks for pointing that out. –  Chad Cooper Feb 23 '12 at 15:32
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.