Selaa lähdekoodia

Null check added. Was throwing exception when serializing document or part of document.

master
Luc Wuyts 9 vuotta sitten
vanhempi
commit
783b272d1a
2 muutettua tiedostoa jossa 8 lisäystä ja 4 poistoa
  1. 6
    4
      DocX/Container.cs
  2. 2
    0
      DocX/Table.cs

+ 6
- 4
DocX/Container.cs Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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;
}

Loading…
Peruuta
Tallenna