跳到主要内容

CreateColorByName

Creates a color selecting it from one of the available color presets.

Syntax

expression.CreateColorByName(sPresetColor);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sPresetColorRequiredPresetColorA preset selected from the list of the available color preset names.

Returns

ApiColor

Example

This example creates a color selecting it from one of the available color presets.

let worksheet = Api.GetActiveSheet();
let color = Api.CreateColorByName("peachPuff");
worksheet.GetRange("A2").SetValue("Text with color");
worksheet.GetRange("A2").SetFontColor(color);