internal float getMarginAttribute(XName name)
{
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(name);
if (top != null)
{
float f;
if (float.TryParse(top.Value, out f))
return (int)(f / 20.0f);
}
return 0;
}