Back to Devexpress

WriteProtectionOptions.ClearPassword() Method

officefileapi-devexpress-dot-spreadsheet-dot-writeprotectionoptions-a950e612.md

latest1.8 KB
Original Source

WriteProtectionOptions.ClearPassword() Method

Clears the password used to modify a workbook.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void ClearPassword()
vb
Sub ClearPassword

Remarks

The following example removes write-protection from a workbook:

csharp
using (Workbook workbook = new Workbook())
{
    workbook.LoadDocument("WriteProtectedDocument.xlsx");
    RemoveWriteProtection(workbook);
}
// ...

private void RemoveWriteProtection(Workbook workbook)
{
    if (workbook.DocumentSettings.WriteProtection.IsPasswordProtected)
        workbook.DocumentSettings.WriteProtection.ClearPassword();
}
vb
Using workbook As New Workbook()
    workbook.LoadDocument("WriteProtectedDocument.xlsx")
    RemoveWriteProtection(workbook)
End Using
' ...

Private Sub RemoveWriteProtection(workbook As Workbook)
    If workbook.DocumentSettings.WriteProtection.IsPasswordProtected Then
        workbook.DocumentSettings.WriteProtection.ClearPassword()
    End If
End Sub

See Also

WriteProtectionOptions Interface

WriteProtectionOptions Members

DevExpress.Spreadsheet Namespace