10using NanoXLSX.Registry;
11using NanoXLSX.Registry.Attributes;
12using NanoXLSX.Utils.Xml;
14using System.Collections.Generic;
22 [NanoXlsxPlugIn(PlugInUUID = PlugInUUID.PasswordWriter)]
30 public PasswordType
Type {
get;
private set; }
45 this.PasswordHash = hash;
64 public void Init(PasswordType type,
string passwordHash)
67 this.PasswordHash = passwordHash;
75 public void CopyFrom(IPassword passwordInstance)
77 throw new NotImplementedException();
95 throw new NotImplementedException();
105 throw new NotImplementedException();
114 throw new NotImplementedException();
123 List<XmlAttribute> attributes =
new List<XmlAttribute>();
124 if (
Type == PasswordType.WorksheetProtection)
126 attributes.Add(XmlAttribute.CreateAttribute(
"password",
PasswordHash));
130 attributes.Add(XmlAttribute.CreateAttribute(
"workbookPassword",
PasswordHash));
Static class that contains enums for password handling.
bool PasswordIsSet()
Gets whether a password to write is defined.
void SetPassword(string plainText)
Not relevant for the writer (inherited from IPassword).
string GetPassword()
Not relevant for the writer (inherited from IPassword).
string PasswordHash
Gets or sets the password hash.
void Init(PasswordType type, string passwordHash)
Initializer method with all mandatory parameters.
void UnsetPassword()
Not relevant for the writer (inherited from IPassword).
LegacyPasswordWriter()
Default constructor.
LegacyPasswordWriter(PasswordType type, string hash)
Default constructor with parameter.
IEnumerable< XmlAttribute > GetAttributes()
Gets the XML attributes of the current password instance, that are used when writing XLSX files.
void CopyFrom(IPassword passwordInstance)
Not relevant for the writer (inherited from IPassword).
PasswordType Type
Current target type of the password instance.
Interface, used by specific writers that provides password handling.