• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Calculation Fields > Styling Text with Calculations

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 attributes—color, font, style, and size—within 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 recipient's name appear in boldface (Figure 4.62).

Figure 4.62. The TextStyleAdd function can change the style of parts of a calculation field.

To change text styles

Choose File > Define > Database (Control+Shift+D/Command+Shift+D).

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.

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.

Click to the right of “Full Name.” Type a semicolon (;). Type bold and then a closing parenthesis (Figure 4.64). Click OK twice to finish.

Figure 4.64. The style name must be spelled correctly, but is not case sensitive.

✓ Tips

  • 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 can't 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 font's 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:
















TextStyleRemove (text ; styles)

Removes the specified style(s) from text. Syntax and available styles are the same as TextStyleAdd, except Plain.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint