formula to control font size with number of carriage returns/lines

I know I can change font size of a field with a formula in the format text area based on length of string, but is there a way to change font size based on how many lines/carriage returns the memo field contains?

For example:
If memo field contains 3 carriage returns, then font size 10
If memo field contains 4 carriage returns, then font size 9
If memo field contains 4 carriage returns, then font size 8
etc.

I have this field in a report, but I have limited vertical space to fit it and the field can vary from 2 lines up to 8 lines, so I need to shrink the text so it always fits in the same space of the textbox that the field is nested in.
IO_DorkAsked:
Who is Participating?
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
You can find out how many logical lines (how many line feeds + 1) are in the database column by doing something like:
UBound(Split({your_Field}, CHR(10)))

If you need a more precise way to fit text into a given space, there's a UFL that automatically sets a given text font to fit it into given dimensions.
0
 
mlmccCommented:
Are the CR part of the text or are you looking at a text field that is wrapping?

mlmcc
0
 
IO_DorkAuthor Commented:
its technically a "memo" field of my database table.

example of data in the memo field:

ABC Company
11148 Main St.
Anytown, US 99999
ABA#xxxx-xxxx-x
Acct.#YYYYYYYYYY (Checking)
0
 
mlmccCommented:
If you call the formula Ido provided CR_Count, you can use something like the below in the format formula for font size


If {@CR_Count} = 1 then
    14
Else if {@CR_Count} = 2 then 
    12
Else if {@CR_Count} = 3 then
    10
Else 
    8

Open in new window


mlmcc
0
 
IO_DorkAuthor Commented:
Thanks, works perfectly!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.