ExcelScript.CellControl type

Représente un contrôle interactif à l’intérieur d’une cellule.

type CellControl =
        | UnknownCellControl
        | EmptyCellControl
        | MixedCellControl
        | CheckboxCellControl;

Remarques

Utilisateur

Pour en savoir plus sur les types de cet alias de type, consultez les liens suivants.

ExcelScript.UnknownCellControl, ExcelScript.EmptyCellControl, ExcelScript.MixedCellControl, ExcelScript.CheckboxCellControl

Exemples

/**
 * This script creates a task list and displays the completion values as checkboxes.
 */
function main(workbook: ExcelScript.Workbook) {
  const sheet = workbook.addWorksheet();
  const taskRange = sheet.getRange("A1:B4");

  // Add tasks and their completion values.
  taskRange.setValues([
    ["Task", "Complete"],
    ["Review data", true],
    ["Update chart", false],
    ["Send report", false]
  ]);

  // Display the Boolean values in the Complete column as checkboxes.
  const checkboxRange = sheet.getRange("B2:B4");
  const checkboxControl: ExcelScript.CellControl = {
    type: ExcelScript.CellControlType.checkbox
  };
  checkboxRange.setControl(checkboxControl);

  taskRange.getFormat().autofitColumns();
}