SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface ISheetProtection

    Interface representing the protection settings for a sheet. Extends the base IProtection interface with additional sheet-specific protection options.

    interface ISheetProtection {
        isIProtection: true;
        isISheetProtection: true;
        addListeners(
            listeners: IProtection.IListeners,
            options?: IListener.Options,
        ): Remove;
        checkPassword(password?: string): Promise<boolean>;
        getProperties(): Partial<ISheetProtection.Properties> | null;
        hasPassword(): boolean;
        isAutoTableAllowed(): boolean;
        isDeleteColumnsAllowed(): boolean;
        isDeleteRowsAllowed(): boolean;
        isFormatCellsAllowed(): boolean;
        isFormatColumnsAllowed(): boolean;
        isFormatRowsAllowed(): boolean;
        isInsertColumnsAllowed(): boolean;
        isInsertHyperlinksAllowed(): boolean;
        isInsertRowsAllowed(): boolean;
        isLocked(): boolean;
        isObjectsAllowed(): boolean;
        isPaused(): boolean;
        isPivotTablesAllowed(): boolean;
        isReadOnly(): boolean;
        isScenariosAllowed(): boolean;
        isSelectLockedCellsAllowed(): boolean;
        isSelectUnlockedCellsAllowed(): boolean;
        isShowFormulasAllowed(): boolean;
        isSortAllowed(): boolean;
        lock(
            properties?: Partial<ISheetProtection.Properties>,
            password?: string,
            algorithm?: string,
            spinCount?: number,
        ): Promise<
            IProtection<
                ISheetProtection,
                ISheetProtection.Properties,
                ISheetProtection.JSON,
            >,
        >;
        pause(
            password?: string,
        ): Promise<
            IProtection<
                ISheetProtection,
                ISheetProtection.Properties,
                ISheetProtection.JSON,
            >,
        >;
        resume(): IProtection<
            ISheetProtection,
            ISheetProtection.Properties,
            ISheetProtection.JSON,
        >;
        setProperties(
            properties: Partial<P>,
        ): Promise<
            IProtection<
                ISheetProtection,
                ISheetProtection.Properties,
                ISheetProtection.JSON,
            >,
        >;
        toJSON(): IProtection.JSON | null;
        unlock(
            password?: string,
        ): Promise<
            IProtection<
                ISheetProtection,
                ISheetProtection.Properties,
                ISheetProtection.JSON,
            >,
        >;
    }

    Hierarchy (View Summary)

    Index
    isIProtection: true

    For runtime type checking.

    isISheetProtection: true

    For runtime type checking.

    • Verifies if the provided password matches the current protection password.

      Parameters

      • Optionalpassword: string

        The password to check against the current protection.

      Returns Promise<boolean>

      true if the password is correct, false otherwise.

      Use this method to validate the password before unlocking or modifying the protection settings.

    • Returns true if the protection has a password.

      Returns boolean

    • Checks if the AutoTable functionality is protected on the sheet.

      Returns boolean

      true if AutoTable is locked, false otherwise.

    • Checks if deleting columns is protected on the sheet.

      Returns boolean

      true if deleting columns is locked, false otherwise.

    • Checks if deleting rows is protected on the sheet.

      Returns boolean

      true if deleting rows is locked, false otherwise.

    • Checks if formatting cells is protected on the sheet.

      Returns boolean

      true if formatting cells is locked, false otherwise.

    • Checks if formatting columns is protected on the sheet.

      Returns boolean

      true if formatting columns is locked, false otherwise.

    • Checks if formatting rows is protected on the sheet.

      Returns boolean

      true if formatting rows is locked, false otherwise.

    • Checks if inserting columns is protected on the sheet.

      Returns boolean

      true if inserting columns is locked, false otherwise.

    • Checks if inserting hyperlinks is protected on the sheet.

      Returns boolean

      true if inserting hyperlinks is locked, false otherwise.

    • Checks if inserting rows is protected on the sheet.

      Returns boolean

      true if inserting rows is locked, false otherwise.

    • Checks if the object is currently locked.

      Returns boolean

      true if the object is locked, false otherwise.

      This method returns true If the lock is active.

    • Checks if objects (e.g., charts, shapes) are protected on the sheet.

      Returns boolean

      true if objects are locked, false otherwise.

    • Checks if the object has a locked but is paused.

      Returns boolean

      true if the object is locked but paused, false otherwise.

    • Checks if pivot tables are protected on the sheet.

      Returns boolean

      true if pivot tables are locked, false otherwise.

    • If the element is protected as readonly.

      Returns boolean

      Readonly is set cannot be changed.

    • Checks if scenarios are protected on the sheet.

      Returns boolean

      true if scenarios are locked, false otherwise.

    • Checks if locked cells may be selected on the protected sheet.

      Returns boolean

      false if the sheet refuses selection of its locked cells while protected.

      Defaults to true, and is always true while the sheet is not locked (including paused).

    • Checks if unlocked cells may be selected on the protected sheet.

      Returns boolean

      false if the sheet refuses selection of its unlocked cells while protected.

      Defaults to true, and is always true while the sheet is not locked (including paused).

    • Checks if formulas may be shown on the protected sheet.

      Returns boolean

      false if the sheet hides its formulas while protected.

      • While this is false, a cell's formula shows only when its style grants it (ICellProtection.isShowFormulas) — an exception, the way an always-unlocked cell is one.
      • Defaults to true, and is always true while the sheet is not locked (including paused).
    • Checks if sorting is protected on the sheet.

      Returns boolean

      true if sorting is locked, false otherwise.

    • Locks the object (workbook or sheet or range) with the specified options and password.

      Parameters

      • Optionalproperties: Partial<ISheetProtection.Properties>

        The properties to allow to remain unlocked. Omitted, the options the object already carries are used (see unlock and setProperties).

      • Optionalpassword: string

        The password required to unlock the object.

      • Optionalalgorithm: string

        The algorithm for encrypting the password.

      • OptionalspinCount: number

        The spin count for encrypting the password.

      Returns Promise<
          IProtection<
              ISheetProtection,
              ISheetProtection.Properties,
              ISheetProtection.JSON,
          >,
      >

      The IProtection instance for method chaining.

      By default all properties are locked but you can specify which properties to remain unlocked. Throws when the object is already protected, paused included.

    • Temporarily disables protection with the provided password.

      Parameters

      • Optionalpassword: string

        The password required to pause protection.

      Returns Promise<
          IProtection<
              ISheetProtection,
              ISheetProtection.Properties,
              ISheetProtection.JSON,
          >,
      >

      The IProtection instance for method chaining.

      This method allows temporarily pausing protection without permanently unlocking the object. Use resume to restore protection.

      Not a shortcut for unlock, even on a lock without a password: unlocking is a document change (the file saves unprotected, and the password is gone), whereas a pause keeps the whole configuration - password, options, and any session access already granted to an IProtectedRange - and resume restores it exactly. The password is required only when one is set. Throws when the object is not locked.

      The paused state is session-only and is never serialized.