'Declaration Public ReadOnly Property IsFileWriteProtected As System.Boolean
public System.bool IsFileWriteProtected {get;}
Workbook instances loaded from files or streams with a write protection password will initially have IsFileWriteProtected set to true. It is recommended that consumers of these instances prevent (or at least warn) users from automatically overwriting the files or streams from which the instances were loaded. These instances will initially not have their HasFileWriteProtectionPassword set to true. Although it is possible to validate a file write protection password when provided via ValidateFileWriteProtectionPassword, it is not possible to obtain the original password from the loaded file or stream. So file write protected Workbook instances which are loaded, but which never have the proper file write protection password validated will be saved without file write protection. Only when the password is validated via ValidateFileWriteProtectionPassword or overwritten via SetFileWriteProtectionPassword will HasFileWriteProtectionPassword return true, indicating that file write protection will be added to subsequently saved files or streams.
When IsFileWriteProtected is true and the file write protected password is validated via ValidateFileWriteProtectionPassword or overwritten via SetFileWriteProtectionPassword, IsFileWriteProtected will subsequently return false, indicating that the file or stream from which the Workbook was loaded can automatically be overwritten by the user if desired.
Note: The Workbook and its related sub-objects do not prevent modifications at runtime when a file is write protected, as Microsoft Excel allows UI modifications to write protected files which are not unlocked with the proper password. In addition, write protected Workbook instances do not prevent saves to the file location from which they were loaded, as it is possible to overwrite files in this situation in Microsoft Excel via the 'Save As' dialog. It is the responsibility of the Workbook's consumer to prevent automatic file overwrites when IsFileWriteProtected is true.
Target Platforms: Windows 8.1, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
Workbook Class
Workbook Members
HasFileWriteProtectionPassword Property
SetFileWriteProtectionPassword(String,String) Method
SetFileWriteProtectionPassword(SecureString,String) Method
ValidateFileWriteProtectionPassword(String) Method
ValidateFileWriteProtectionPassword(SecureString) Method
View on GitHub