Class ExcelWriteProtection
File sharing settings for the workbook.
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public class ExcelWriteProtection : XmlHelper
Properties
IsReadOnly
If the workbook is set to readonly and has a password set.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ReadOnlyRecommended
If the author recommends that you open the workbook in read-only mode.
Declaration
public bool ReadOnlyRecommended { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
UserName
The name of the person enforcing the write protection.
Declaration
public string UserName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
RemoveReadOnly()
Remove any write protection set on the workbook
Declaration
public void RemoveReadOnly()
SetReadOnly(string, string)
Writes protectes the workbook with a password. EPPlus uses SHA-512 as hash algorithm with a spin count of 100000.
Declaration
public void SetReadOnly(string userName, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userName | The name of the person enforcing the write protection |
| string | password | The password. Setting the password to null or empty will remove the read-only mode. |