Hi,
I use text formatting tags to get different text sizes within one label. The Problem ist, that there is a "&" in some of my name-attributes. It seams, that these "&"-characters are interpreted as part of the formatting tags. Is there a possibility to tell ArcGIS Pro Framework, that the "&" should not be interpreted as part of the formatting tags?
(It would not be a problem to write a exclusion-tag into my name-attribute field, since I only use them for labeling.)
My Label Expression is:
$feature.NAME + "\n" + "<FNT size= '12'>" +"(" + $feature.NUMBER + " TEXT)" + "</FNT>"
$feature.name containes the "&" character in some cases. In these cases the Lebel in the maps is:
"NAME" <FNT size='12'>(NUMBER TEXT)<\FNT>
<FNT size='12'>(NUMBER TEXT)<\FNT>
So the tags are part of the shown labels and the part which has the Lebels appears two times there.
Does anybody know a solution or a hint, what I can try to solve the problem?
Thanks
David
Solved! Go to Solution.
On the Text Formatting tags documentation page, it mentions special characters:
The ampersand (&) and angle bracket (<) are special characters and are not valid in your text if formatting tags are used. Use the equivalent character codes & and < instead.
below that, it also shows to to replace them in your code
If you have special characters embedded in the values of the label field, you can replace them dynamically using a simple label script.
Label Expression - Arcade
"<BOL>" + replace($feature.Notes, "&", "&") + "</BOL>"
Label Expression - VBScript
Function FindLabel ([LABELFIELD]) NewString = Replace([LABELFIELD],"&","&") FindLabel = "<ITA>" & NewString & "</ITA>" End Function
On the Text Formatting tags documentation page, it mentions special characters:
The ampersand (&) and angle bracket (<) are special characters and are not valid in your text if formatting tags are used. Use the equivalent character codes & and < instead.
below that, it also shows to to replace them in your code
If you have special characters embedded in the values of the label field, you can replace them dynamically using a simple label script.
Label Expression - Arcade
"<BOL>" + replace($feature.Notes, "&", "&") + "</BOL>"
Label Expression - VBScript
Function FindLabel ([LABELFIELD]) NewString = Replace([LABELFIELD],"&","&") FindLabel = "<ITA>" & NewString & "</ITA>" End Function
Hi Ken,
thank you so much, your solution works perfectly!
Thanks, very helpful!
Your "text formatting tags" link is broken now. I couldn't find this information about special characters in the official dynamic text documentation.