Spread Windows Forms 13.0 Product Documentation
GrapeCity.Spreadsheet Assembly / GrapeCity.Spreadsheet Namespace / IWorkbook Interface / Protect Method
A WorkbookLocks value indicates which data will be protected.
A string value that specifies a case-sensitive password for the worksheet or workbook.


In This Topic
    Protect Method (IWorkbook)
    In This Topic
    Protects a workbook so that it cannot be modified.
    Syntax
    'Declaration
     
    Function Protect( _
       ByVal locks As WorkbookLocks, _
       Optional ByVal password As String _
    ) As Boolean
    'Usage
     
    Dim instance As IWorkbook
    Dim locks As WorkbookLocks
    Dim password As String
    Dim value As Boolean
     
    value = instance.Protect(locks, password)
    bool Protect( 
       WorkbookLocks locks,
       string password
    )

    Parameters

    locks
    A WorkbookLocks value indicates which data will be protected.
    password
    A string value that specifies a case-sensitive password for the worksheet or workbook.

    Return Value

    true if the workbook is protected successful, false otherwise.
    Remarks
    Note that support for WorkbookLocks and password is limited to reading and writing the OpenXML file. All options of WorkbookLocks have same effect in runtime.
    Requirements

    Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

    See Also