Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4   11.5    Statistic    FMM    Blog  


Creates styled text from JSON made with Text.Style.

Component Version macOS Windows Linux Server iOS SDK
Text 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.FromStyles"; json )   More


Parameter Description Example
json A JSON text or reference.


Returns styled text or error.


Creates styled text from JSON made with Text.Style.
Great function to construct styled text via JSON functions.
Input is a JSON array with objects.
Each object with a "text" item is considered and others ignored.
If there is a "hasSize" entry with false, we ignore size. Otherwise we read "size" value and use it.
If there is a "hasFont" entry with false, we ignore font details. Otherwise we lookup "font" entry and use it as font name. If that is missing, we look for "fontID" entry with a font ID. For FileMaker before version 14, we look also for "fontScript" entry.
If there is a "hasColor" entry with false, we ignore color details. Otherwise we look for "red", "green" and "blue". If one exists, we use them for color. If an "alpha" entry exists, we add the alpha value. Alternatively we use "colorHex" for a hex color value.
If there is a "hasFace" entry with false, we ignore face style. Otherwise we lookup "face" with a numeric value for the style. We then also look for boolean entries named bold, italic, underline, outline, shadow, condense, extend, strikethrough, smallCaps, superscript, subscript, wordUnderline, doubleUnderline entries to adjust style.

Some blue text with hex color[{"colorHex":"0044FE","alpha":255,"text":"blue"}]
Same blue text with red, green and blue.[{"red":0,"green":68,"blue":254,"alpha":255,"text":"blue"}]
Text in bold[{"text":"Hello", "bold":true}]
Text in 24pt[{"text":"Hello", "size":24}]
Text in Comic Sans font[{"text":"Hello", "font":"Comic Sans MS"}]
Hello underlined and World strike through[{"text":"Hello", "underlined": true}, {"text": " "}, {"text":"World", "strikethrough": true}]


Create styled text with JSON:

MBS( "Text.FromStyles"; "[{\"text\":\"Hello\", \"underlined\": true}, {\"text\": \" \"}, {\"text\":\"World\", \"strikethrough\": true}]")

See also

Release notes

Example Databases

Blog Entries

Created 19th May 2021, last changed 19th May 2021

Text.FindBetween - Text.InvalidCharactersForEncoding

Feedback: Report problem or ask question.

MBS Xojo Plugins

Start Chat