Novacode.DocX.setMarginAttribute C# (CSharp) Method

setMarginAttribute() private method

private setMarginAttribute ( System.Xml.Linq.XName xName, float value ) : void
xName System.Xml.Linq.XName
value float
return void
        internal void setMarginAttribute(XName xName, float value)
        {
            XElement body = mainDoc.Root.Element(XName.Get("body", w.NamespaceName));
            XElement sectPr = body.Element(XName.Get("sectPr", w.NamespaceName));
            XElement pgMar = sectPr?.Element(XName.Get("pgMar", w.NamespaceName));
            XAttribute top = pgMar?.Attribute(xName);
            top?.SetValue(value * 20);
        }