Search Results for

    Show / Hide Table of Contents

    TProtection Class

    Encryption data for an Excel sheet.

    Syntax

    Namespace: FlexCel.Core

    public sealed class TProtection

    Methods

    Name Description
    SetModifyPassword Sets the password for modifying the file. It won't encrypt the file, it just won't let Excel save the file. On Excel goto Options->Security to check it.
    Note that you can only set it, there is no way to retrieve an existing password.
    SetWorkbookProtection Protects the workbook. On Excel goto Protect->Workbook to check it.
    GetWorkbookProtection​Options Reads the Workbook protection options for a file.
    SetWorkbookProtection​Options Sets the workbook protection options for a file.
    SetSharedWorkbook​Protection Protects the change history from being removed. On Excel goto Protect->Protect Shared Workbook to check it.
    GetSharedWorkbook​Protection​Options Reads the protection options for the change history.
    SetSharedWorkbook​Protection​Options Sets the change history protection options for a file.
    SetSheetProtection Protects a sheet. On Excel goto Protect->Sheet to check it.
    GetSheetProtection​Options Return the sheet protection options for the file.
    SetSheetProtection​Options Sets the sheet protection options for the file.
    GetProtectedRange Returns a protected range.
    AddProtectedRange Adds a protected range to the sheet.
    DeleteProtectedRange Deletes an existing protected range.
    ClearProtectedRanges Removes all protected ranges in the sheet.
    AssignedOnPassword Returns true is there is at least one event handler attached to then OnPassword event.
    RemoveAllOnPassword​Events Removes all event handlers attached to OnPassword.

    Properties

    Name Description
    EncryptionType Encryption mode for xls files .
    EncryptionAlgorithm​Xlsx Encryption algorithm for xlsx files.
    OpenPassword Sets the password to open the file. When set, the file will be encrypted. On Excel go to Options->Security to check it.
    Set this to null to clear it.
    HasModifyPassword Returns true if the file has a password to modify.
    RecommendReadOnly Returns true if the file is recommended to open read-only.
    HasWorkbookPassword Returns true if the workbook is protected with a password.
    HasSharedWorkbook​Password Returns true if the change history is protected with a password.
    HasSheetPassword Returns true if the active sheet is protected with a password.
    WriteAccess Reads or sets the user writing the file. Useful to know which user opened the file in Excel when you want to save and the file is in use.
    ProtectedRangeCount Returns a the count of protected ranges in the active sheet.

    Events

    Name Description
    OnPassword It is called when opening a password protected file, so you can supply the correct password.
    If you know beforehand that the file is protected you do not need this event, just use the OpenPassword method on this object.
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com