Q:

Help with formatting ArcGIS text elements with Python

I'm struggling with a formatting issue that comes from inserting text into a Text Element object in ArcGIS using Python. I want to print a table of values of which all but the last column are numbers. My python script loops through a list and applies formatting to each element like this:
#Text element is referenced:
tableTextQuad1 = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "tableTextQuad1")[0]
#All of the work occurs within a function that takes the table, x postion, y position, and text element reference (txtBox1) as its arguments)
#A clone of the element is created and used by the newCellText
newCellText = txtBox1.clone("_clone")  
#A for loop is used to loop through lines in a table, and each line is formatted like so:
reformat1 = '{:>3}      {:>6.2f}      {:>3}      {:>7.2f}      {:>7.2f}     {:<10}'.format(t[0], t[1], t[2], t[3], t[4], t[5])
myList.append(reformat1)
myList.append('\n')
#To get rid of commas I do the following:   
alpha = "', '".join(myList).replace("', '", "")
#Then the alpha string is sent to the cloned text object    
newCellText.text = '{:}'.format(alpha)
newCellText.elementPositionX = x1
newCellText.elementPositionY = y1

When I don't include the last element (t[5]) the table looks great...like this:

But as soon as I try adding the string t[5] (which are directions like North, South...) to the line everything in the line gets shifted and seems to ignore the width and character spacing allocation I set in .format(). The result looks like this:
 
I've tried many different formatting parameters for t[5] but nothing seems to work the way I want it.  Can anyone tell me why all the numbers would adhere to formatting rules like right/left justify and width but the inclusion of letters on the same line messes it all up?
What is the correct formatting I should use?
Many thanks in advance for help!
*Update - I have also tried adding a carriage return to the \n, so that '\r\n' is appended to each line, but this does not fix my problem. Could it be a bug?

A:

Try making the text element a little bit wider and saving it again. Looks like you have the thing set to justify, so it's trying to fit everything in the line width as best it can. If you switch that off it might lay out better. And if possible, set it to a fixed-width font like Consolas or Courier New, trying to line things up with spaces with a proportional font without settable tab stops is an exercise in futility.

