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

XL.Format.SetPatternForegroundColor

Sets the foreground color of the fill pattern.

Component Version macOS Windows Linux Server iOS SDK
XL 3.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.Format.SetPatternForegroundColor"; Book; Format; Value )   More

Parameters

Parameter Description Example
Book The reference to the workbook. Please use XL.LoadBook to load a file. $ref
Format The index of the format in the book to target. 0
Value The new setting. $value

Result

Returns OK or error.

Description

Sets the foreground color of the fill pattern.
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 in XL.Font.SetColor.

This is the foreground color for the pattern, you can put in the background of a cell. If your pattern is stripes, the one color is the foreground one and the other the background one. Setting no foreground color and using a pattern, can lead to use of the default color (black).

Examples

Sets the foreground color of the fill pattern to red to fill cell red:

If [ MBS( "XL.Book.GetRGBMode"; $book) = 0 ]
      Set Variable [ $r; Value: MBS( "XL.Format.SetPatternForegroundColor"; $book; $format; 10) ]
Else
      Set Variable [ $c; Value: MBS( "XL.Color.Pack"; $book; 255; 0; 0) ]
      Set Variable [ $r; Value: MBS( "XL.Format.SetPatternForegroundColor"; $book; $format; $c) ]
End If
Set Variable [ $r; Value: MBS( "XL.Format.SetFillPattern"; $book; $format; 1 ) ]

See also

This function checks for a license.

Created 18th August 2014, last changed 2nd November 2021


XL.Format.SetPatternBackgroundColor - XL.Format.SetRotation