Finding a happy place in text formatting isn’t always as simple as you might think. Sure, plain, black on white text gets dull, but we’ve all seen embellishments get out of hand when somebody combines bold, underline, and strikethrough. But restrained, judicious application of style can improve the experience and that’s where TextStyleAdd can be of aid.
TextStyleAdd ( Text ; Style(s) )
The first parameter behaves just as you’d expect. It accepts plain text inside quotation marks, a field name, or a variable. That second parameter can only contain combinations of the 17 pre-defined styles.
TextStyleAdd ( “chicken musket” ; Bold ) will return “chicken musket“.
You may combine styles by placing a plus sign between them. To wit:
TextStyleAdd ( “Wednesday Everyday!” ; Bold+Strikethrough ) will return “
Bear in mind that changes applied by TextStyleAdd are cumulative. If you run the function to make some text italic, then run another TextStyleAdd to add highlighting, the italic will still be present. If you get careless, you could end up with some hideously styled text.
In the list of all available styles below, you’ll notice that some are mutually exclusive (Lowercase and Uppercase e.g.). My informal testing shows that when passing conflicting styles in a single function call, FileMaker disregards them.
The one big downer about TextStyleAdd is that the Style parameter must be entered as text in the calculation; FileMaker does not recognize styles entered as field values or script variables. Believe me, it won’t. I’ve tried a dozen different ways of abstracting and calculating around this limitation, all to no avail. The closest I can get it to put the entire TextStyleAdd calculation in a text field, then use Evaluate ( table::textField ) to apply the styles. It works, but is ridiculously cumbersome. If I can secure and explanation for this limitation, I’ll be sure to update this post.