Formatting tags doesn't seem to work?

1577
5
11-05-2012 08:50 AM
MikeMacRae
Occasional Contributor III
Hey everyone,

I am trying to do a simple format of a text box in Arcmap. It looks like this:

M1-h6; 5
25/12

Where the first line is to be one color and the second line is to be another color.

I went into the 'About Formating Text' and copied the tag example to change color and when I apply the setting, the text doesn't change color and the tags appear in the text like this:

[ATTACH=CONFIG]19017[/ATTACH]

I'm not sure why this isn't working?
Tags (2)
0 Kudos
5 Replies
KenBuja
MVP Esteemed Contributor
The formatting tags won't work there are the symbols "<" or "&" in the fields that are being formatted. These special characters have to be replaced like in the following script (see the help topic for more information):

Function FindLabel ([LABELFIELD]) 
  NewString = Replace([LABELFIELD],"&","&amp;") 
  FindLabel = "<ITA>" & NewString & "</ITA>" 
End Function
0 Kudos
JoelCalhoun
New Contributor III
In addition to Ken's example, here is a label expression for parsing a parcel number and displaying different parts as different colors based on specific RGB values.

Function FindLabel ([PIN])
firsttwo = cint(left([PIN], 2))
block_qtrsec = cint(mid([PIN], 7, 3))
lot_parcel = mid([PIN], 10, 3)
sub_acct = right([PIN], 2)

if (firsttwo > 26 and firsttwo < 33) then
    block = "<CLR red='56' green='168' blue='0'>" & cstr(block_qtrsec) & "-" & "</CLR>" 
    lot = "<CLR red='56' green='168' blue='0'>" & lot_parcel & "</CLR>"  
else
    block = "<CLR red='169' green='0' blue='230'>" & cstr(block_qtrsec) & "</CLR>" & " |"
    intLot = cint(lot_parcel)
    lot = "<CLR red='0' green='112' blue='255'>" & cstr(intLot) & "</CLR>"   
end if

sublabel = "<CLR red='255' green='0' blue='0'>" & "-" & sub_acct & "</CLR>"

FindLabel = block & lot & sublabel
End Function




Joel
0 Kudos
MikeMacRae
Occasional Contributor III
Hey,

Thanks for replying both of you, but as I mentioned, this is a text box not label annotation.

I think I had a couple things wrong, but in the end, this is what works in the text box properties dialogue box:

M1-c1; 3
<CLR red = "255">27/30</CLR>

The example in the help menu has the tags surrounded in double quotes, which I think you would use in a label expression. In the text box, you need to remove these quotes for it to work. The way the have the help menu set up is a little confusing. They have categories for 'Labeling' and 'Annotation' which is the same to me. It should be categorized as 'Labeling' and 'Text Element' or something like that.
0 Kudos
JoelCalhoun
New Contributor III
Hey,

Thanks for replying both of you, but as I mentioned, this is a text box not label annotation.



Yeah, sorry I guess I should have read your question a little more throughly instead of just jumping to a response.
I must have assumed you were talking about labels since you can just change the color of the text in the text box.
But I guess it makes sense that you want to use one text box instead of two that are aligned and grouped together.


As to the help documentation here are Esri's definitions for labels, annotation, and graphic text:

Label
Descriptive text based on one or more feature attributes. Labels are placed dynamically on or near features based on user-defined rules and in response to changes in the map display. Labels cannot be individually selected and modified by the user.

Annotation
Text or graphics that can be individually selected, positioned, and modified. Annotation may be manually entered or generated from labels. Annotation can be stored as features in a geodatabase or as map annotation in a data frame. There are two types of geodatabase annotation: standard annotation, which is not formally associated with features in the geodatabase, and feature-linked annotation, which is associated with a specific feature in another feature class through a relationship class.

Graphic text
Graphic text is useful for adding information on and around your map that exists in page space, as opposed to annotation, which is stored in geographic space. Dynamic text is a type of graphic text that, when placed on a map layout, will change dynamically based on the current properties of the map document, data frame, or Data Driven Page.


In a way non-feature-linked annotation is a lot like Graphic Text as they are both static.  I guess Esri just listed Annotation in the help as it functions similarly to Graphic Text but I do agree it is a little confusing.

Anyway I'm glad you figured it out.


Joel
0 Kudos
MargaretGooding
New Contributor III
I am using ArcMap 10.1 and want to make the first line of a text box (map annotation) bold and the next two lines not bold. I used the form: 
<BOL>Ethanac O/H*</BOL>
Access Caltrans ROW SW
of RR & I-215 from Case Rd
It did not bold the first line with the remainder not bold. It just displayed all of it as if it were regular text. Ethanac O/H* should be bold. It is not and the words BOL show up.
0 Kudos