Sfoglia il codice sorgente

Enumerations.cs

-----------------
EditRestrictions 

DocX.cs
--------
EditRestrictions GetProtectionType()
AddProtection(EditRestrictions er)
master
coffeycathal_cp 15 anni fa
parent
commit
97cc1fc974
2 ha cambiato i file con 34 aggiunte e 1 eliminazioni
  1. 25
    1
      DocX/DocX.cs
  2. 9
    0
      DocX/_Enumerations.cs

+ 25
- 1
DocX/DocX.cs Vedi File

static internal XNamespace customVTypesSchema = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"; static internal XNamespace customVTypesSchema = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes";
#endregion #endregion
public bool isProtected
public bool isProtected
{ {
get get
{ {
} }
} }
public EditRestrictions GetProtectionType()
{
if (isProtected)
{
XElement documentProtection = settings.Descendants(XName.Get("documentProtection", DocX.w.NamespaceName)).FirstOrDefault();
string edit_type = documentProtection.Attribute(XName.Get("edit", DocX.w.NamespaceName)).Value;
return (EditRestrictions)Enum.Parse(typeof(EditRestrictions), edit_type);
}
return EditRestrictions.none;
}
public void AddProtection(EditRestrictions er)
{
if (er == EditRestrictions.none)
return;
XElement documentProtection = new XElement(XName.Get("documentProtection", DocX.w.NamespaceName));
documentProtection.Add(new XAttribute(XName.Get("edit", DocX.w.NamespaceName), er.ToString()));
documentProtection.Add(new XAttribute(XName.Get("enforcement", DocX.w.NamespaceName), "1"));
settings.Root.AddFirst(documentProtection);
}
public void RemoveProtection() public void RemoveProtection()
{ {
// Remove every node of type documentProtection. // Remove every node of type documentProtection.

+ 9
- 0
DocX/_Enumerations.cs Vedi File

nine nine
} }
public enum EditRestrictions
{
none,
readOnly,
forms,
comments,
trackedChanges
}
/// <summary> /// <summary>
/// Table Cell Border styles /// Table Cell Border styles
/// Added by lckuiper @ 20101117 /// Added by lckuiper @ 20101117

Loading…
Annulla
Salva