Field Calculator

3713
3
02-04-2015 06:42 AM
JonPeroff
New Contributor II

In the attribute table, when calculating one field by combing two string fields can one be in bold font?  example:

 

Field AField BField C
AABBAA - BB

 

In field C,  the AA is bolded.  How can this be achieved?  I'm using 9.3 and don't have any experience with python.  Any help/suggestions would be appreciated.

3 Replies
AnthonyGiles
Frequent Contributor II

Jon,

There is no capability for text formatting in the attribute table, you can only provide formatting to labels and dynamic text from the attribute table

Regards

Anthony

JonPeroff
New Contributor II

OK, thanks.  I want the bolded font to show appear in the TOC or map legend not necessarily the attribute table.  I can't seem to do it through the layers properties dialog box.

0 Kudos
MicahBabinski
Regular Contributor

Hi Jon,

Your best bet may be to convert the legend to graphics and individually edit the elements of your legend by making parts of the text element bold. I believe text elements will implement html formatting, so perhaps use the <b>Text</b> tags to make the text bold.

I'm not sure how many unique values you're trying to show in your legend, or if the pieces of text that you want to make bold fit a certain pattern, but if you break the legend into individual layout elements you may be able to conditionally make them bold using the arcpy.mapping TextElement object to apply the changes.

Perhaps something like:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT":(
   if elm.text == "AA - BB":
   elm.text = "<b>AA</b> - BB"
mxd.save()
del mxd

Let me know if you find a solution! One of my colleagues occasionally has to perform similar operations on map layouts and would be interested in the results of your effort.

Warm Regards,

Micah