跳到主要内容

SetInCellDropdown

设置数据验证是否显示包含可接受值的下拉列表。

语法

expression.SetInCellDropdown(InCellDropdown);

expression - 表示 ApiValidation 类的变量。

参数

名称必需/可选数据类型默认值描述
InCellDropdown必需boolean指定是否显示下拉列表。

返回值

此方法不返回任何数据。

示例

此示例设置是否显示下拉列表。

// How to show or hide the validation dropdown list.

// Set the InCellDropdown setting.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("A1");
let validation = range.GetValidation();
validation.Add("xlValidateList", null, null, "Apple,Banana,Cherry");
validation.SetInCellDropdown(true);
worksheet.GetRange("B1").SetValue("Dropdown is enabled for A1");