Brian Dunning's FileMaker Custom Functions

Abscind ( text ; margin )

Adds or repositions line breaks in supplied text so it wraps to specified margins.

  Average rating: 4.6 (38 votes) Log in to vote

Ray Cologon   Ray Cologon
NightWing Enterprises
http://www.nightwing.com.au/FileMaker

Share on Facebook Share on Twitter

  Sample input:
Abscind ( "This is some text which may or may not have line breaks, but which we want to fit within a specified character width (between margins)." , 35 )
  Sample output:
This is some text which may or
may not have line breaks, but
which we want to fit within
a specified character width
(between margins).

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This is a function that uses a recursive routine to re-format a supplied block of text so that it falls within a specified margin width - ie it ensures that there is a line break before the spcified number of characters is reached on each line.

If the input text contains paragraphs which are separated by double carriage returns, these are preserved in the text that is returned.

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.

If the input text already contains carriage returns to mark hard line breaks they will be re-positioned to conform to the new specified margin width.

Note that the results may be variable depending on the font used: proportional-spaced fonts, since they do not adhere to a fixed character width, may exhibit more variability in the result than one would see with a mono-spaced font.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.