跳到主要内容

SetThemeColors

设置当前电子表格的主题颜色。

语法

expression.SetThemeColors(sTheme);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
sTheme必需string将设置到当前电子表格的配色方案。

返回值

boolean

示例

此示例设置当前电子表格的主题颜色。

// How to get all theme colors and apply one of them.

// Apply one of the theme colors from the array of available ones.

let worksheet = Api.GetActiveSheet();
let themes = Api.GetThemesColors();
for (let i = 0; i < themes.length; ++i) {
worksheet.GetRange("A" + (i + 1)).SetValue(themes[i]);
}
Api.SetThemeColors(themes[3]);
worksheet.GetRange("C3").SetValue("The 'Apex' theme colors were set to the current spreadsheet.");