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

    Interface IWorkbookProtection

    Interface representing protection settings for a workbook. This interface allows for getting and setting passwords, managing structure and window locks, and handling revision protection.

    interface IWorkbookProtection {
        isIProtection: true;
        isIWorkbookProtection: true;
        addListeners(
            listeners: IProtection.IListeners,
            options?: IListener.Options,
        ): Remove;
        checkPassword(password?: string): Promise<boolean>;
        getProperties(): Partial<IWorkbookProtection.Properties> | null;
        hasPassword(): boolean;
        isLocked(): boolean;
        isPaused(): boolean;
        isReadOnly(): boolean;
        isRevisionAllowed(): boolean;
        isStructureAllowed(): boolean;
        isWindowsAllowed(): boolean;
        lock(
            properties?: Partial<IWorkbookProtection.Properties>,
            password?: string,
            algorithm?: string,
            spinCount?: number,
        ): Promise<
            IProtection<
                IWorkbookProtection,
                IWorkbookProtection.Properties,
                IWorkbookProtection.JSON,
            >,
        >;
        pause(
            password?: string,
        ): Promise<
            IProtection<
                IWorkbookProtection,
                IWorkbookProtection.Properties,
                IWorkbookProtection.JSON,
            >,
        >;
        resume(): IProtection<
            IWorkbookProtection,
            IWorkbookProtection.Properties,
            IWorkbookProtection.JSON,
        >;
        setProperties(
            properties: Partial<P>,
        ): Promise<
            IProtection<
                IWorkbookProtection,
                IWorkbookProtection.Properties,
                IWorkbookProtection.JSON,
            >,
        >;
        toJSON(): IProtection.JSON | null;
        unlock(
            password?: string,
        ): Promise<
            IProtection<
                IWorkbookProtection,
                IWorkbookProtection.Properties,
                IWorkbookProtection.JSON,
            >,
        >;
    }

    Hierarchy (View Summary)

    Index
    isIProtection: true

    For runtime type checking.

    isIWorkbookProtection: 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 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 the object has a locked but is paused.

      Returns boolean

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

    • If the element is protected as readonly.

      Returns boolean

      Readonly is set cannot be changed.

    • Checks if workbook revisions are locked. Locking revisions prevents changes to the workbook without the revision password.

      Returns boolean

      true if revisions are locked, false otherwise.

    • Checks if the workbook structure is locked. Locking the structure prevents changes like adding or deleting sheets.

      Returns boolean

      true if the structure is locked, false otherwise.

    • Checks if workbook windows are locked. Locking the windows prevents changes to window position and size.

      Returns boolean

      true if windows are locked, false otherwise.

    • Temporarily disables protection with the provided password.

      Parameters

      • Optionalpassword: string

        The password required to pause protection.

      Returns Promise<
          IProtection<
              IWorkbookProtection,
              IWorkbookProtection.Properties,
              IWorkbookProtection.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.