EricC Posted July 4, 2022 Share Posted July 4, 2022 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') Quote Link to comment Share on other sites More sharing options...
jwhittaker Posted July 7, 2022 Share Posted July 7, 2022 // 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.CalculateTextExtent(str); tm.useTags = false; var tmWidth = tm.textWidth; var tmNumberofLines = tm.textLines; return tmNumberofLines; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.