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.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Sets the color of the font.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
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 |
Returns OK or error.
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 |
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)]
Created 18th August 2014, last changed 5th May 2016
XL.Font.SetBold - XL.Font.SetItalic
Feedback: Report problem or ask question.