Back to Devexpress

Worksheet.IsProtected Property

officefileapi-devexpress-dot-spreadsheet-dot-worksheet-ad556799.md

latest4.9 KB
Original Source

Worksheet.IsProtected Property

Gets whether the worksheet is protected.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool IsProtected { get; }
vb
ReadOnly Property IsProtected As Boolean

Property Value

TypeDescription
Boolean

true , if the worksheet is protected; otherwise, false.

|

Remarks

Use the IsProtected property to check whether the worksheet is already protected before applying protection with the Worksheet.Protect method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsProtected property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/ProtectionActions.cs#L51

csharp
// Protect the worksheet with a password.
if (!worksheet.IsProtected)
    worksheet.Protect("password", WorksheetProtectionPermissions.Default);

winforms-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/ProtectionActions.cs#L38

csharp
// Protect a worksheet. Prevent users from making changes to worksheet elements.
if (!worksheet.IsProtected)
    worksheet.Protect("password", WorksheetProtectionPermissions.Default);

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/ProtectionActions.cs#L36

csharp
// Prevent users from making changes to worksheet elements
if (!worksheet.IsProtected)
    worksheet.Protect("password", WorksheetProtectionPermissions.Default);

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/ProtectionActions.vb#L48

vb
' Protect the worksheet with a password.
If Not worksheet.IsProtected Then
    worksheet.Protect("password", WorksheetProtectionPermissions.Default)

winforms-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_API_Part02/SpreadsheetActions/ProtectionActions.vb#L42

vb
' Protect a worksheet. Prevent users from making changes to worksheet elements.
If Not worksheet.IsProtected Then
    worksheet.Protect("password", WorksheetProtectionPermissions.Default)

wpf-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/ProtectionActions.vb#L40

vb
' Prevent users from making changes to worksheet elements
If Not worksheet.IsProtected Then
    worksheet.Protect("password", WorksheetProtectionPermissions.Default)

See Also

Protect(String, WorksheetProtectionPermissions)

Worksheet Interface

Worksheet Members

DevExpress.Spreadsheet Namespace