Brian Dunning's FileMaker Custom Functions

HTML_this ( Text, Line, Bolded, Italics, Uline, Font, Size, Color, BGcolor, Justification )

Simple function to add basic old school HTML formatting to a block of text.

  Be the first to rate this function Log in to vote

David Simmons   David Simmons - Show more from this author
Ideawise
http://ideawise.com

Share on Facebook Share on Twitter

  Sample input:
HTML_this ( $YourText ; 1 ; 1 ; 1 ; "yes" ; "Arial" ; 4 ; "Red" ; "Yellow" ; "left" )
  Sample output:
Well I can't show it here but you'd end up with Bolded Italic Underlined Larger Red text on a Yellow background, Left justified, and in it's own line

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

This is a very simple function meant to give a block of Text some basic 'ol skool HTML formatting, particularly for something like eMailing with the BaseElements BE_SMTP functions (not required for this to work).

This does NOT format a whole page, or substitute for line returns (see the bottom of the comments for one suggestion on how to do this), and I'm certain it could be done in a cooler way, or with fancy CSS, or HTML5 compliant goodies. But this worked perfect for me for assembling a HUGE bunch of variables made up of different parts of a report from multiple records across tables, and allowing me to format them individually to send out a snazy eMail message with emphasis wherever I wanted. I just built this quickly for something I needed. Feel free to swipe and improve. Hope it helps you.

Note: This will format all of the "Text" component the same way, but only the text within this function.

INSTRUCTIONS:
For each yes or no value either "yes" or the numeral 1 evaluates as "True"
For all other values a specific answer is required, otherwise put "" and it will be ignored.

"Text" is your text obviously. But this can be extensive, like a "List" of related records.

"Line" means it is encapsualted in "



"Bold", "Italics", and "Uline" (underline) are self explanatory, either on or off .

Font should be: "Arial", "Courier", "Georgia", "Times", "Trebuchet", or "Verdana"
You can enter these words alone and the function will substitute the recommended equivalents such as "Arial, Helvetica, sans-serif". Or enter the whole thing if you want.

Size should be a number from 1 to 7 which defines the size of the text. Browser default is 3.

Color should be one of…
color_name (like "red")
hex_number (like "#ff0000")
An extensive list of color names and hex numbers can be found here: https://www.w3schools.com/colors/colors_names.asp

"Justification" should be "left", "center", "right", or "justified"


SUGGESTION: If you want to send one or more of these components in an eMail, you may want to wrap them in an HTML header. (the BaseElements BE_SMTPSend function also allows for a separate text version of the eMail, which is recommended). You could do something like below (which I swiped from somewhere else). Feel free to change the default font info, that's just what will happen to anything you don't use this function on.


SEE THE FUNCTION COMMENTS FOR SAMPLE PAGE HTML

 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: