Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

CSStoFMText (text)

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.3  (41 votes)
  Discuss this Custom Function

Christopher Gauntt, Cordega Solutions
http://www.cordega.com

Converts CSS inline styles to FileMaker Pro Text

Sample Input:
<SPAN STYLE= "text-transform: uppercase;" >Let's see how it converts back.</SPAN>
Sample Output:
LET'S SEE HOW IT CONVERTS BACK.


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

This takes CSS styled text and converts it back to FileMaker Pro formatting.
The Hex to RGB converter calc was supplied by Klemens Müller, www.klemenso.de, 05.07.2006

Note: I don't have the fontScript variable figured out yet. I couldn't find anything in CSS documentation that seemed equivalent. But the variable is there in case someone else figures it out.

UPDATE: April 6, 2009
Added If statement to wrap around function in case text doesn't have any SPAN tags.

Note, if you not converting a field directly, don't forget to put the \ before the quote if you are embedding the tags into a calculation.

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:

5 most recent comments | Show all 6 comments

I finally got around to fixing it. Sorry for the ridiculously long delay. I didn't even know there was a problem until one of my colleagues found the function and the comment.

Christopher Gauntt, North Hollywood
May 15, 2010 5:21pm

I convert GetAsCSS(field) back
I needed an additional Substitute(field," ¶","") . (that's substitute space newline with empty)

Thank you for the very helpful function CSSToFMText and Happy New Year 2011.

Peter F., Zurich
December 31, 2010 10:05am

Nice little function. Ive been working on building text editor functions into a FM database am trying to find a slick way to get formatted text into a MS word document. This kind of thing is helpful and may form part of the solution

One small bug:

"Strikethrough" is "Line-through" in CSS land.

Also It doesn't handle chinese characters. A must in this corner of the world.

Mike

Mike, Taipei
January 19, 2011 1:19am

I had to add the following for it to successfully render the line breaks.

Key changes are lower case line break and added extra substitute for <br/>

Here is the change and addition. Works just fine now in FM14 and thanks heaps.

// swaps out breaks with FileMaker return markers
; $_Text = Substitute ( $_TextSpan ; "<br>" ; "¶" )
; $_Text = Substitute ( $_TextSpan ; "<br/>" ; "¶" )

Peter van Herk, Brisbane, Australia
July 16, 2015 4:05pm

Regarding your comment, Peter. The Substitute function is case sensitive and there is sometimes a space before the forward slash. So the full list should be:

// swaps out breaks with FileMaker return markers
; $_Text = Substitute ( $_TextSpan ; "<br>" ; "¶" )
; $_Text = Substitute ( $_TextSpan ; "<br/>" ; "¶" )
; $_Text = Substitute ( $_TextSpan ; "<br />" ; "¶" )
; $_Text = Substitute ( $_TextSpan ; "<BR>" ; "¶" )
; $_Text = Substitute ( $_TextSpan ; "<BR/>" ; "¶" )
; $_Text = Substitute ( $_TextSpan ; "<BR />" ; "¶" )

Or, the nested version:

$_Text =
Substitute (
$_TextSpan;
[ "<br>" ; "¶" ];
[ "<br/>" ; "¶" ];
[ "<br />" ; "¶" ];
[ "<BR>" ; "¶" ];
[ "<BR/>" ; "¶" ];
[ "<BR />" ; "¶" ];
)

Same goes for the Substitute function at the top as well.

Alec, Brooklyn
December 01, 2016 4:01am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 5 + 8 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions