officefileapi-devexpress-dot-spreadsheet-dot-writeprotectionoptions-a950e612.md
Clears the password used to modify a workbook.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
void ClearPassword()
Sub ClearPassword
The following example removes write-protection from a workbook:
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();
}
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