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:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
XL.Font.SetColor
Sets the color of the font.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| XL | 3.5 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example |
|---|---|---|
| book | The reference to the workbook. Please use XL.LoadBook to load a file. | $ref |
| Font | The index of the font in the book to target. | 0 |
| Value | The new font color. | 255 |
Result
Returns OK or error.
Description
Sets the color of the font.If you set value and book is in RGB mode you can use XL.ColorPack function to get a numeric value for color components. If the book is not in RGB mode, you can use color values as described below.
Color values if not in RGB Mode:
| Black | 8 |
| White | 9 |
| Red | 10 |
| Brightgreen | 11 |
| Blue | 12 |
| Yellow | 13 |
| Pink | 14 |
| Turquoise | 15 |
| Darkred | 16 |
| Green | 17 |
| Darkblue | 18 |
| Darkyellow | 19 |
| Violet | 20 |
| Teal | 21 |
| Gray25 | 22 |
| Gray50 | 23 |
| Periwinkle Cf | 24 |
| Plum Cf | 25 |
| Ivory Cf | 26 |
| Lightturquoise Cf | 27 |
| Darkpurple Cf | 28 |
| Coral Cf | 29 |
| Oceanblue Cf | 30 |
| Iceblue Cf | 31 |
| Darkblue Cl | 32 |
| Pink Cl | 33 |
| Yellow Cl | 34 |
| Turquoise Cl | 35 |
| Violet Cl | 36 |
| Darkred Cl | 37 |
| Teal Cl | 38 |
| Blue Cl | 39 |
| Skyblue | 40 |
| Lightturquoise | 41 |
| Lightgreen | 42 |
| Lightyellow | 43 |
| Paleblue | 44 |
| Rose | 45 |
| Lavender | 46 |
| Tan | 47 |
| Lightblue | 48 |
| Aqua | 49 |
| Lime | 50 |
| Gold | 51 |
| Lightorange | 52 |
| Orange | 53 |
| Bluegray | 54 |
| Gray40 | 55 |
| Darkteal | 56 |
| Seagreen | 57 |
| Darkgreen | 58 |
| Olivegreen | 59 |
| Brown | 60 |
| Plum | 61 |
| Indigo | 62 |
| Gray80 | 63 |
| Default Foreground | 64 |
| Default Background | 65 |
| Tooltip | 81 |
| Auto | 32767 |
Examples
Make a font blue in non RGB mode:
MBS( "XL.Font.SetColor"; $book; $font10; 12 )
Writes sheet with red font:
#create new xls file
Set Variable [$book; Value:MBS( "XL.NewBook"; 0 )]
#create fonts
Set Variable [$redColor; Value:MBS( "XL.Color.Pack"; $book; 255; 0; 0)]
Set Variable [$redFont; Value:MBS( "XL.Book.AddFont"; $book)]
Set Variable [$r; Value:MBS( "XL.Font.SetColor"; $book; $redFont; $redColor)]
#
#create formats
Set Variable [$redFormat; Value:MBS( "XL.Book.AddFormat"; $book)]
Set Variable [$r; Value:MBS( "XL.Format.SetFont"; $book; $redFormat; $redFont)]
#
#create sheet
Set Variable [$sheet; Value:MBS( "XL.Book.AddSheet"; $book; "Sales Receipt")]
#
#add number in red
Set Variable [$r; Value:MBS( "XL.Sheet.CellWriteNumber"; $book; $sheet; 5; 3; 123; $redFormat)]
#
Set Field [Writing data::Output; MBS("XL.Book.Save"; $book; "test.xls")]
Set Variable [$r; Value:MBS("XL.Book.Release"; $book)]
Create font with color 22:
Set Variable [$titleFont; Value:MBS( "XL.Book.AddFont"; $book)]
Set Variable [$r; Value:MBS( "XL.Font.SetColor"; $book; $titlefont; 22)]
See also
- XL.Font.GetBold
- XL.Font.GetColor
- XL.Font.SetBold
- XL.Format.SetBorderBottomColor
- XL.Format.SetBorderLeftColor
- XL.Format.SetBorderRightColor
- XL.Format.SetBorderTopColor
- XL.Format.SetFont
- XL.Format.SetPatternBackgroundColor
- XL.NewBook
Example Databases
Created 18th August 2014, last changed 5th May 2016
XL.Font.SetBold - XL.Font.SetItalic
Feedback: Report problem or ask question.
Links
MBS FileMaker Plugins