Set label width/word wrap when using text balloons

7054
5
01-21-2015 01:16 PM
BenColeman1
New Contributor II

Hi there,

 

I have not been able to find a way to specify maximum width of text balloons that are generated by labeling.  The work-around I'm currently implementing is converting the labels to annotation, then manually placing carriage returns in each balloon to approximate the ideal balloon width.  As you might imagine, this is very time consuming.

 

Thanks in advance for your help.

 

PS  I'm using the Maplex label engine in ArcMap 10.1

0 Kudos
5 Replies
MahtabAlam1
Occasional Contributor

You can try using label expression to break up the resulting text based on some character width. Following is an example script:

def FindLabel ( [myField] ):
  result = ""
  counter = 1
  for char in [myField]:
    result = result + char
    if ( counter % 5 == 0):
      result = result + '\n'
    counter = counter + 1
  return result

Please note line 6, in this snippet character width is 5.

HTH

0 Kudos
BenColeman1
New Contributor II

I see the reason you might do this, but doesn't it sometimes arbitrarily cut words across multiple lines?

0 Kudos
MahtabAlam1
Occasional Contributor

It's just an example and can be modified to make sure it doesn't split words. I would stick to label stacking as as a better approach unless I need complex text parsing.

0 Kudos
WendyHarrison
Esri Contributor

Maplex has a stack labels option

About stacking labels—Help | ArcGIS for Desktop

you can restrict the number of characters per line and also the number of lines.

Wendy

BenColeman1
New Contributor II

This is what I needed.  I had it set to stack labels, but because my label expression contained five `VbCrLf`s, the label was exceeding the default maximum number of lines allowed (3) in every case.  I upped the maximum to 10 lines and that did the trick.