GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    WorkbookProtection Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Workbook protection settings. Supported in XLSX only.

    • C#
    • VB.NET
    public sealed class WorkbookProtection
    Public NotInheritable Class WorkbookProtection
    Inheritance:
    System.Object
    WorkbookProtection
    Remarks

    Properties in this class are simply written to Excel file and have no effect on the behavior of this library. For more information on workbook protection, consult Microsoft Excel documentation.

    Properties

    HasPassword

    Gets a value indicating whether the protected workbook has a password.

    • C#
    • VB.NET
    public bool HasPassword { get; }
    Public ReadOnly Property HasPassword As Boolean
    Property Value
    System.Boolean

    PasswordHash

    Gets or sets the password hash for protected workbook.

    • C#
    • VB.NET
    public int PasswordHash { get; set; }
    Public Property PasswordHash As Integer
    Property Value
    System.Int32
    Remarks

    This property needs to be set to ushort value (property is of type int because ushort is not CLS compliant). For setting password, a SetPassword(String) method can also be used.

    ProtectStructure

    Gets or sets if workbook structure is protected. Default value is false.

    • C#
    • VB.NET
    public bool ProtectStructure { get; set; }
    Public Property ProtectStructure As Boolean
    Property Value
    System.Boolean

    ProtectWindows

    Gets or sets if workbook window is protected. Default value is false.

    • C#
    • VB.NET
    public bool ProtectWindows { get; set; }
    Public Property ProtectWindows As Boolean
    Property Value
    System.Boolean

    Methods

    SetPassword(String)

    Sets the password for protected workbook.

    • C#
    • VB.NET
    public void SetPassword(string password)
    Public Sub SetPassword(password As String)
    Parameters
    password
    System.String

    The password.

    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.