Partager via


Excel.CellControl type

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

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

Remarques

[ Ensemble d’API : ExcelApi 1.18 ]

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

Excel.UnknownCellControl, Excel.EmptyCellControl, Excel.MixedCellControl, Excel.CheckboxCellControl

Exemples

// 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();
});