SheetXL - v1.0.2
    Preparing search index...

    Interface ICellControl

    A control drawn in the cells of a range, such as a checkbox.

    A cell control decorates the cell's value; it never holds one. A checkbox draws TRUE as checked and FALSE or blank as unchecked, and a click writes the boolean into the cell, where formulas read it as any other value. Excel's model is the same: the checkbox is a cell format, and Clear Formats removes it while the value stays.

    • A cell has at most one control. One control covers any number of cells, and its ranges shift, split, copy and fill with them.
    • A control draws only the values its type accepts (isAccepted). Any other value draws as plain text: a checkbox over 2 or "true" draws 2 or true, as in Excel.
    • Most code never needs this interface: ICellRange.setControl and ICellRange.getControls stand in for Office Scripts' Range.setControl / getControl.
    interface ICellControl {
        isIAnchored: true;
        isICellControl: true;
        addListeners(
            listeners: ICellControl.IListeners,
            options?: IListener.Options,
        ): Remove;
        close(): void;
        delete(): void;
        getAnchorType?(): IAnchored.Type;
        getName?(): string | null;
        getRange(): ICellRange;
        getRanges(options?: ICellRange.GetRangeOptions): ICellRanges;
        getType(): string;
        isAccepted(value: Scalar): boolean;
        isClosed(): boolean;
        isDeleted(): boolean;
        isProtected(): boolean;
        toJSON(): ICellControl.JSON;
    }

    Hierarchy (View Summary)

    Index
    isIAnchored: true

    For runtime type checking.

    isICellControl: true

    For runtime type checking.

    • Similar to delete but cleans resources and can't be undone.

      Returns void

    • Deletes the anchored item.

      Returns void

    • The name of the anchor or null if it has none.

      Returns string | null

    • Returns the ranges this object is anchored to, in authored order.

      Parameters

      Returns ICellRanges

      • Never null. An item whose last range was removed by a row/column delete returns an invalid ranges — ask ICellRanges.isInvalid, the same contract as ITable.getDataRange.
      • This is the general accessor. Most anchored types hold exactly one range and declare their own getRange() for it, but data validations, conditional formats and protected ranges are authored as several, and any single range can become several when a delete splits it.
    • The control's type, such as 'checkbox'.

      Returns string

      A type nobody has registered (CellControlRegistry) is kept and saved as it was read; it accepts no value, so its cells draw as text.

    • Whether the control draws a cell holding value.

      Parameters

      • value: Scalar

      Returns boolean

      A checkbox accepts a boolean or a blank cell. A value it does not accept draws as the cell would without the control.

    • Returns if the model has been closed

      Returns boolean

    • Returns if the model has been deleted

      Returns boolean

    • If the anchor is unable to be modified.

      Returns boolean