Skip to Content
avatar image
Former Member

Auto-size Textboxes based on Fields Value Length

So I am attempting to create a report title that includes 3 different Database fields all on a single line separated by a dash that can vary in size rather dramatically so if I set them to a fixed size there will be large gaps between them when the text is smaller in size. I see that I can create a formula for a Width Adjustment. Is there so formula I can do to adjust the textbox width based on length of the string being displayed within it?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 04, 2017 at 08:17 AM

    Use the Crystal function Length() this returns number of characters in a text field.

    You can use this to set width


    Add comment
    10|10000 characters needed characters exceeded

    • Just remembered width is defined in twips (whatever they are) 1500 twips is about 2.5cm

      so formula will be something like

      If length({TextField}) < 50 then 3000 else 6000


  • Apr 05, 2017 at 08:02 AM

    Hi Eric,

    I believe you're trying to create three separate text objects separated by a dash? You only need ONE text object! Here's how:

    1. Insert a 'Text Object' (Insert option > Text Object)

    2. Place the first field inside this text object.

    3. Double-click this text object and you should see a cursor at the very beginning. Move it to the end of the field and type in a 'dash'.

    4. Place the second field inside this text object after the dash.

    5. Repeat steps 3 and 4 for the next field.

    6. Increase the size of the text object to fit width of the page.


    Add comment
    10|10000 characters needed characters exceeded