Novacode.DocX.GetProtectionType C# (CSharp) Method

GetProtectionType() public method

Returns the type of editing protection imposed on this document.
public GetProtectionType ( ) : EditRestrictions
return EditRestrictions
        public EditRestrictions GetProtectionType()
        {
            if (isProtected)
            {
                XElement documentProtection = settings.Descendants(XName.Get("documentProtection", w.NamespaceName)).FirstOrDefault();
                string edit_type = documentProtection.Attribute(XName.Get("edit", w.NamespaceName)).Value;
                return (EditRestrictions)Enum.Parse(typeof(EditRestrictions), edit_type);
            }

            return EditRestrictions.none;
        }