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  (42 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.

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 1 + 2 =
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. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions