跳到主要内容

CreateColorFromRGB

Creates an RGB color setting the appropriate values for the red, green and blue color components.

Syntax

expression.CreateColorFromRGB(r, g, b);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
rRequiredbyteRed color component value.
gRequiredbyteGreen color component value.
bRequiredbyteBlue color component value.

Returns

ApiColor

Example

This example creates an RGB color setting the appropriate values for the red, green and blue color components.

var oWorksheet = Api.GetActiveSheet();
var oColor = Api.CreateColorFromRGB(255, 111, 61);
oWorksheet.GetRange("A2").SetValue("Text with color");
oWorksheet.GetRange("A2").SetFontColor(oColor);