跳到主要内容

GetClassType

返回 ApiUniColor 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiUniColor 类的变量。

参数

此方法没有任何参数。

返回值

"uniColor"

示例

读取电子表格中形状中使用的颜色对象的类类型。

// How do I identify what type of color object is applied to a shape in a spreadsheet?

// Confirm the color category by checking its type label in a spreadsheet.

const worksheet = Api.GetActiveSheet();
const presetColor = Api.CreatePresetColor("peachPuff");
const gs1 = Api.CreateGradientStop(presetColor, 0);
const gs2 = Api.CreateGradientStop(Api.RGB(255, 111, 61), 100000);
const fill = Api.CreateLinearGradientFill([gs1, gs2], 5400000);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
worksheet.AddShape("flowChartOnlineStorage", 60 * 36000, 35 * 36000, fill, stroke, 0, 2 * 36000, 1, 3 * 36000);
const classType = presetColor.GetClassType();
worksheet.SetColumnWidth(0, 15);
worksheet.SetColumnWidth(1, 10);
worksheet.GetRange("A1").SetValue("Class Type = ");
worksheet.GetRange("B1").SetValue(classType);