Styling Text with Calculations
In previous versions of FileMaker, you could only format a calculated text field with a single style. A workaround for this limitation required so much effort that you only did so if it was critically important. In FileMaker Pro 7, you can use the Text functions to easily mix type attributescolor, font, style, and sizewithin the same calculated field.Using the calculated field Label we created in "Formatting Labels or Envelopes" on page 64, we can use the Text functions to make the recipients name appear in boldface (Figure 4.62).
Figure 4.62. The TextStyleAdd function can change the style of parts of a calculation field.
[View full size image]
To change text styles
1 .Choose File > Define > Database (Control+Shift+D/Command+Shift+D).2 .Click the Fields tab. Double-click the Label field. When the Specify Calculation dialog box appears, click to put the cursor at the beginning of the calculation.3 .Double-click TextStyleAdd in the function list. With "text ; styles" highlighted, press the Delete key (Figure 4.63). Delete the closing parenthesis and the extra spaces.
Figure 4.63. The first parameter is the text you want to apply the style to, the second is the style name.
[View full size image]
Figure 4.64. The style name must be spelled correctly, but is not case sensitive.
[View full size image]
Be careful when selecting a text color when you format text in a calculated field. The function allows you to select only RGB colors. Some RGB colors cant be reproduced accurately by a color printer.Changing a text style is not always the same as selecting the true bold or italic weight of the font you are using. If you want to use a fonts real italic, use TextFont instead of TextStyleAdd, and type the real typeface name (like Baskerville Bold Italic) in the FontName parameter.
Text Formatting Functions
TextColor (text ; RGB (red ; green ; blue) )Changes the color of text to any RGB color combination. RGB (0 ; 0 ; 0) results in black, RGB (255 ; 255 ; 255) results in white.TextFont (text ; fontName { ; fontScript} )Changes the typeface to the font specified. The specified font must be available to the computer and spelled correctly (case sensitive). The optional fontScript parameter allows you to specify alternative language character sets, like Chinese or Cyrillic.TextSize (text ; fontSize )Changes the point size to the size specified. FontSize must be a positive integer.TextStyleAdd (text ; styles)Changes text to the style(s) specified. Multiple styles must be separated by + signs. Style names do not have spaces and are not case sensitive. Available styles are:PlainBoldItalicUnderlineCondensedExtendedStrikethroughSmallCapsSuperscriptSubscriptUppercaseLowercaseTitlecaseWordUnderlineDoubleUnderlineTextStyleRemove (text ; styles) Removes the specified style(s) from text. Syntax and available styles are the same as TextStyleAdd, except Plain.