Excel.CellControlType enum

表示单元格控件的类型。

注解

[ API 集:ExcelApi 1.18 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml

// Add checkboxes to the table.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getActiveWorksheet();

  // Get the second column in the table, without the header.
  const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange();

  // Change the boolean values to checkboxes.
  range.control = {
    type: Excel.CellControlType.checkbox
  };
  await context.sync();
});

字段

checkbox = "Checkbox"

表示复选框控件的类型。

empty = "Empty"

表示空控件的类型。

mixed = "Mixed"

表示混合控制结果的查询的类型。

unknown = "Unknown"

表示未知控件的类型。 这表示在 Excel 的未来版本中添加的控件,而当前版本的 Excel 不知道如何显示此控件。