Ver código fonte

Merge pull request #76 from lucwuyts/master

Null check added.  Was throwing exception when serializing document o…
master
PrzemyslawKlys 9 anos atrás
pai
commit
b2c123d27d
2 arquivos alterados com 8 adições e 4 exclusões
  1. 6
    4
      DocX/Container.cs
  2. 2
    0
      DocX/Table.cs

+ 6
- 4
DocX/Container.cs Ver arquivo

@@ -184,10 +184,12 @@ namespace Novacode
}
XElement body = Xml.Element(XName.Get("body", DocX.w.NamespaceName));
XElement baseSectionXml = body.Element(XName.Get("sectPr", DocX.w.NamespaceName));
var baseSection = new Section(Document, baseSectionXml) { SectionParagraphs = parasInASection };
sections.Add(baseSection);
if (body != null)
{
XElement baseSectionXml = body.Element(XName.Get("sectPr", DocX.w.NamespaceName));
var baseSection = new Section(Document, baseSectionXml) { SectionParagraphs = parasInASection };
sections.Add(baseSection);
}
return sections;
}
}

+ 2
- 0
DocX/Table.cs Ver arquivo

@@ -2593,6 +2593,8 @@ namespace Novacode
get
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
return false;
XElement tblHeader = trPr.Element(XName.Get("tblHeader", DocX.w.NamespaceName));
return tblHeader != null;
}

Carregando…
Cancelar
Salvar