arcpy bold, italic, underline stand alone script

1536
4
01-03-2012 09:19 AM
deleted-user-MS0lE1F_0-sy
Occasional Contributor
How would I Bold a portion of my text element?  This script loses its next line functionality if I use <BOL></BOL>.  How do I correct this?


finaltext = ("<BOL>Result1:</BOL>" + '\n' + textValue1 + '\n' + " " + '\n' + "<BOL>Result2:</BOL>" + '\n' + textValue2 + '\n' + " " + '\n' + "<BOL>Result3:</BOL>" + '\n' + textValue3 + '\n' + " ")
el1to3.text = finaltext

This script will Bold the Result1 but all the rest of it is jumbled on one line on top of each other. 

I would like it to look like this-

Result1:
a
b
c
Result2:
a
b
c
Tags (2)
0 Kudos
4 Replies
JasonScheirer
Occasional Contributor III
Use \r\n instead of \n
0 Kudos
deleted-user-MS0lE1F_0-sy
Occasional Contributor
This works great when I use it for one of them:

finaltext = ("<BOL>Result1:</BOL>" + '\r\n' + textValue1 + '\n' + " " + '\n' + "Result2:" + '\n' + textValue2 + '\n' + " " + '\n' + "Result3:" + '\n' + textValue3)
el1to3.text = finaltext

Result1: is bold

However when I switch to it doesnt Bold them:
finaltext = ("<BOL>Result1:</BOL>" + '\r\n' + textValue1 + '\n' + " " + '\n' + "<BOL>Result2:<\BOL>" + '\r\n' + textValue2 + '\n' + " " + '\n' + "<BOL>Result3:<\BOL>" + '\r\n' + textValue3)
el1to3.text = finaltext

the results are:
<BOL>Result1:</BOL>
<BOL>Result2:</BOL>
<BOL>Result3:</BOL>


So it seems like I can only use the <BOL></BOL> once?

Maybe you can tell me or point to some literature on when and how to use \r\n versus \n.  I must be searching for the wrong thing. 

I appreciate the help.

Matt
0 Kudos
JasonScheirer
Occasional Contributor III
Replace ALL \ns with \r\n and you'll need to use </BOL>, not <\BOL>.

\r\n is the convention for Windows line breaks, \n is for Unix-like systems. In some places in Windows it's forgiving and lets you use \n, but not in text elements.
0 Kudos
deleted-user-MS0lE1F_0-sy
Occasional Contributor
Got it.  Simple typos always get me.  Thank you for your help and knowledge.
0 Kudos