TextStyleAdd
Purpose
Adds the specified styles to text in a single action.
Format
TextStyleAdd(text;styles)
Parameters
text - any
text expression or text
field styles - any named style listed below in Description
Data type returned
text
Originated in
FileMaker Pro 7.0
Description
You can add multiple styles by using the + operator between style names. Negative values are not valid. All styles will be removed, if the only style specified is Plain. Plain is ignored if mixed with other styles. Styles are not case-sensitive and do not contain spaces.
Text formatting options will be lost if the field type that is returned is something other than text.
The styles that are available are:
•Plain
•Bold
•Italic
•Underline
•HighlightYellow
•Condense
•Extend
•Strikethrough
•SmallCaps
•Superscript
•Subscript
•Uppercase
•Lowercase
•Titlecase
•WordUnderline
•DoubleUnderline
•AllStyles (all available styles)
Note To format or change the case of text, use the
Lower,
Upper, or
Proper function (see
Text functions).
Examples
TextStyleAdd(“Plaid”;Italic) returns the word Plaid in italics.
TextStyleAdd(FirstName;Bold+Underline) returns Sophie in bold, underlined text when the FirstName field contains Sophie.
The following calculation removes all styles from the text, then italicizes the entire phrase.
TextStyleAdd(TextStyleAdd(FirstName;Plain);Italic)
The following calculation creates two descriptions of styles, then concatenates two phrases using these styles. Using the Let function is an effective way to avoid creating a long and complex TextStyleAdd statement.
Let([TitleStyle=Smallcaps+Titlecase;BodyStyle=Plain]; TextStyleAdd(titleField;titleStyle)&"¶¶" & TextStyleAdd(bodyField;BodyStyle))
In the following example, to find every occurrence of several words and change their style, use the Substitute function combined with the TextStyleAdd function.
Substitute(ArticleBody;[“Phrase1”;TextStyleAdd(“Phrase 1”;Italic)];[“Phrase 2”;TextStyleAdd(“Phrase 2”;Bold)];)
Related topics