Parcourir la source

Mirror Margins

Mirror Margins boolean attribute
master
Henrys22 il y a 9 ans
Parent
révision
e8069948f0
1 fichiers modifiés avec 53 ajouts et 0 suppressions
  1. 53
    0
      DocX/DocX.cs

+ 53
- 0
DocX/DocX.cs Voir le fichier

@@ -167,6 +167,59 @@ namespace Novacode
}
}
/// <summary>
/// Mirror Margins boolean value. True when margins has to be mirrored.
/// </summary>
internal bool getMirrorMargins(XName name)
{
XElement body = mainDoc.Root.Element(XName.Get("body", DocX.w.NamespaceName));
XElement sectPr = body.Element(XName.Get("sectPr", DocX.w.NamespaceName));
if (sectPr != null)
{
XElement MarMirror = sectPr.Element(XName.Get("mirrorMargins", DocX.w.NamespaceName));
if (MarMirror != null)
{
return true;
}
}
return false;
}
internal void setMirrorMargins(XName name, bool value)
{
XElement body = mainDoc.Root.Element(XName.Get("body", DocX.w.NamespaceName));
XElement sectPr = body.Element(XName.Get("sectPr", DocX.w.NamespaceName));
if (sectPr != null)
{
XElement MarMirror = sectPr.Element(XName.Get("mirrorMargins", DocX.w.NamespaceName));
if (MarMirror != null)
{
if (!value)
{
MarMirror.Remove();
}
}
else
{
sectPr.Add(new XElement(w + "mirrorMargins", string.Empty));
}
}
}
public bool MirrorMargins
{
get
{
return getMirrorMargins(XName.Get("mirrorMargins", DocX.w.NamespaceName));
}
set
{
setMirrorMargins(XName.Get("mirrorMargins", DocX.w.NamespaceName), value);
}
}
/// <summary>
/// Page width value in points. 1pt = 1/72 of an inch. Word internally writes docx using units = 1/20th of a point.
/// </summary>

Chargement…
Annuler
Enregistrer