Select to view content in your preferred language

Text Element - New Line

554
2
Jump to solution
04-25-2012 03:22 PM
ShaunWeston
Frequent Contributor
I have a text element in a map document that I would like to update from a Python tool in ArcMap/ArcCatalog, however I'm having trouble getting the text to go to a new line.

So this works fine if I write this in the code like this for example:

notesMap = "Note: Cadastral boundaries are indicative only. \nThis Council provides no warranties \nin terms of property boundaries."

This updates the text element with \n starting a new line

However when I change it to this:

notesMap = arcpy.GetParameterAsText(0)

and put that text in a python tool in a toolbox, it does not read the \n bits and just add them into the text element instead of jumping to a new line?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JasonScheirer
Esri Alum
You can use
arcpy.GetParameterAsText(0).replace('\\n', '\r\n')
to get the proper line breaks.

View solution in original post

0 Kudos
2 Replies
JasonScheirer
Esri Alum
You can use
arcpy.GetParameterAsText(0).replace('\\n', '\r\n')
to get the proper line breaks.
0 Kudos
ShaunWeston
Frequent Contributor
Ah awesome that does it! Thanks heaps for that Jason.
0 Kudos