TProtection Class
Encryption data for an Excel sheet.
Syntax
Namespace: FlexCel.Core
public sealed class TProtection
Methods
Name | Description |
---|---|
SetModifyPassword | Sets the password for modifying the file. It won't encrypt the file, it just won't let Excel save the file. On Excel goto Options->Security to check it. Note that you can only set it, there is no way to retrieve an existing password. |
SetWorkbookProtection | Protects the workbook. On Excel goto Protect->Workbook to check it. |
GetWorkbookProtectionOptions | Reads the Workbook protection options for a file. |
SetWorkbookProtectionOptions | Sets the workbook protection options for a file. |
SetSharedWorkbookProtection | Protects the change history from being removed. On Excel goto Protect->Protect Shared Workbook to check it. |
GetSharedWorkbookProtectionOptions | Reads the protection options for the change history. |
SetSharedWorkbookProtectionOptions | Sets the change history protection options for a file. |
SetSheetProtection | Protects a sheet. On Excel goto Protect->Sheet to check it. |
GetSheetProtectionOptions | Return the sheet protection options for the file. |
SetSheetProtectionOptions | Sets the sheet protection options for the file. |
GetProtectedRange | Returns a protected range. |
AddProtectedRange | Adds a protected range to the sheet. |
DeleteProtectedRange | Deletes an existing protected range. |
ClearProtectedRanges | Removes all protected ranges in the sheet. |
AssignedOnPassword | Returns true is there is at least one event handler attached to then OnPassword event. |
RemoveAllOnPasswordEvents | Removes all event handlers attached to OnPassword. |
Properties
Name | Description |
---|---|
EncryptionType | Encryption mode for xls files . |
EncryptionAlgorithmXlsx | Encryption algorithm for xlsx files. |
OpenPassword | Sets the password to open the file. When set, the file will be encrypted. On Excel go to Options->Security to check it. Set this to null to clear it. |
HasModifyPassword | Returns true if the file has a password to modify. |
RecommendReadOnly | Returns true if the file is recommended to open read-only. |
HasWorkbookPassword | Returns true if the workbook is protected with a password. |
HasSharedWorkbookPassword | Returns true if the change history is protected with a password. |
HasSheetPassword | Returns true if the active sheet is protected with a password. |
WriteAccess | Reads or sets the user writing the file. Useful to know which user opened the file in Excel when you want to save and the file is in use. |
ProtectedRangeCount | Returns a the count of protected ranges in the active sheet. |
Events
Name | Description |
---|---|
OnPassword | It is called when opening a password protected file, so you can supply the correct password. If you know beforehand that the file is protected you do not need this event, just use the OpenPassword method on this object. |