Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shrink text to fit into text box

Status
Not open for further replies.

dwanjk

Technical User
Nov 24, 2008
7
US
Hello,

I am creating a 1 page document that contains a text box in the body of the document. Is there a way to shrink the font of the text to fit in the box? I do not want to select "can grow" because this will cause the document to be more than one page.

Thanks in advance for any help you can provide.

J
 
If you want to dynamically reduce the font size to the point where the text fits within a given length, one of the 3rd-party UFLs listed at has a function: GetTextWidth (Text, FontName, FontSize, Bold, Italic, Units) that allows you to control the font size and adjust it to a point where the text is less than a given width.

hth,
- Ido


view, export, burst, email, and schedule Crystal Reports.
 
Assuming the text is a field, you can dynamically change font size depending on number of characters in field. This will not be truly dynamic as you have to test text lengths to suit, but means you can code yourself.

Right click field (not text box) and select format -> font

In formula box opposite size

If length(yourtextfield) >= 50 and length(yourtextfield) < 100 then 10
else
If length(yourtextfield) >= 100 then 8
else 12

Change values to suit your needs

Ian
 
Thank you both for your response. Although it looks like Crystal can't do exactly what i am looking for, I think Ian's formula can work for this report. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top