Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

XL.Color.Pack

Packs red, green and blue components in color type.

Component Version macOS Windows Linux Server iOS SDK
XL 3.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.Color.Pack"; bookRef; red; green; blue )   More

Parameters

Parameter Description Example
bookRef The reference to the workbook. Please use XL.LoadBook to load a file. $ref
red The red color value from 0 to 255. 255
green The green color value from 0 to 255. 255
blue The blue color value from 0 to 255. 255

Result

Returns color value.

Description

Packs red, green and blue components in color type.

Examples

Checks what color value to use for 100% red:

MBS( "XL.Color.Pack"; $$book; 255; 0; 0)
// shows 10 in indexed color mode
// shows 16711680 in RGB mode

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)]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 23th June 2015


XL.Book.Version - XL.Color.UnPack