8using NanoXLSX.Interfaces;
9using NanoXLSX.Interfaces.Writer;
10using NanoXLSX.Registry;
11using NanoXLSX.Registry.Attributes;
12using NanoXLSX.Utils.Xml;
14using System.Collections.Generic;
23 [NanoXlsxPlugIn(PlugInUUID = PlugInUUID.PasswordWriter)]
31 public PasswordType
Type {
get;
private set; }
46 this.PasswordHash = hash;
65 public void Init(PasswordType type,
string passwordHash)
68 this.PasswordHash = passwordHash;
76 public void CopyFrom(IPassword passwordInstance)
78 throw new NotImplementedException();
96 throw new NotImplementedException();
106 throw new NotImplementedException();
115 throw new NotImplementedException();
124 List<XmlAttribute> attributes =
new List<XmlAttribute>();
125 if (
Type == PasswordType.WorksheetProtection)
127 attributes.Add(XmlAttribute.CreateAttribute(
"password",
PasswordHash));
131 attributes.Add(XmlAttribute.CreateAttribute(
"workbookPassword",
PasswordHash));
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.