LineWrap ( text ; margin )
Rate this function: Average rating: 3.1 (12 votes) Discuss this Custom Function
Martin D. Brunner, Zurich Financial Services
http://www.mdb.bz
Adds or repositions line breaks in supplied text so it wraps to specified margins.
Sample Input:
| LineWrap ( "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." ; 25 ) |
|
Sample Output:
Lorem ipsum dolor sit
amet, consectetuer
adipiscing elit, sed
diam nonummy nibh
euismod tincidunt ut
laoreet dolore magna
aliquam erat volutpat. |
|
Description:
This function uses a recursive routine to re-format a supplied block of text so that it falls within a specified margin width.
It ensures that there is a line break (¶) before the specified number of characters is reached on each line but it keeps words together.
If the input text contains no carriage returns, they will be inserted at the appropriate positions so that the text wraps within the defined text block size.
Any number of line breaks (¶) in the original text are preserved for the output.
The results may vary depending on the font used: proportional-spaced fonts (without fixed character width) may exhibit a more variable result than mono-spaced fonts.
I use this function to break text into a specified length of lines in order to afterwards create a tree column layout with the CF "ColumWrap" that can also be found on briandunning.com.
The idea and the basic setup comes from the CF "Abscind" by Ray Cologon, NightWing Enterprises.
I made it easier and modifyed it, so it calculates correctly and also supports multiple line breaks.
Martin D. Brunner - www.mdb.bz
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
This is my Custom Function and I want to
edit it
Discuss:There are no comments yet. Be the first to post a comment about this Custom Function! Please try to keep it brief & to the point. Anyone can post:
|
Newest Custom Functions:
| 1. |
GroupRelationInfo ( FileTarget ; TableTarget ; Result ) |
| |
(Tue, Mar 16, 5:57am) |
| 2. |
GeoBox(latitude;longitude; radius) |
| |
(Mon, Mar 15, 11:04am) |
| 3. |
MonthNameList ( start; number; short ) |
| |
(Sun, Mar 14, 11:45pm) |
| 4. |
matchListAB( ListA ; ListB; match_Value; match_operator ; getN ) |
| |
(Sun, Mar 14, 10:29pm) |
| 5. |
Bin2Hex ( binary ) |
| |
(Sat, Mar 13, 10:08pm) |
| 6. |
SlideView (text) |
| |
(Sat, Mar 13, 8:40pm) |
| 7. |
HashFNV1a64 ( text ; empty ) |
| |
(Sat, Mar 13, 6:23pm) |
| 8. |
HashFNV1a32 ( text ; empty ) |
| |
(Sat, Mar 13, 5:55pm) |
 |
|