Skip to Content
0

Auto-size Textboxes based on Fields Value Length

Apr 04, 2017 at 01:52 AM

22

avatar image

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Ian Waterman Apr 04, 2017 at 08:17 AM
0

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

You can use this to set width

Ian

Show 1 Share
10 |10000 characters needed characters left 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

Ian

0
Abhilash Kumar
Apr 05, 2017 at 08:02 AM
0

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.

-Abhilash

Share
10 |10000 characters needed characters left characters exceeded