Jump to content

Determine number of text lines


Recommended Posts

A text box is 2.25 inches wide.

Inside of that text box I have placed a field named 'Title'


Some titles are very long but the text box is tall enough to accommodate up to 5 lines.


Is there a function or rule I can use, that will return the number of lines for any given record as a result of word wrap?


For example:


'Title 1' will fit on one line therefore return '1'


'Here is Title 2 and it's a bit longer' - I want to know if this will end up wrapping to 2 lines or 3 lines. (That is, I want the rule to return '2' or '3')

Link to comment
Share on other sites

// Use TextMeasure to get the length of each company name

var tm = new FusionProTextMeasure;

var frameWidth = 2.25; // set width of the text box (in inches)

tm.pointSize = "10 pt"; // set the type size

tm.font = "Helvetica"; // set your typeface

var str = Field("Title"); // set the field to use


tm.useTags = false;

var tmWidth = tm.textWidth;

var tmNumberofLines = tm.textLines;


return tmNumberofLines;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...