This project has moved. For the latest updates, please go here.

Error When Copy Table with Design is None

Mar 18, 2014 at 8:06 AM
Edited Mar 18, 2014 at 8:29 AM
i user "docx.InsertTable(table0)" to copy Table ,but it throw exception
and i debug the source code,find the eception happen at
    public Table InsertTable(Table t)
        XElement newXElement = new XElement(t.Xml);

        Table newTable = new Table(Document, newXElement);
        newTable.Design = t.Design;

        return newTable;
newTable.Design = t.Design; this row cause the exception.
is i incorrect using?

The Error Pos
            if (tableStyle == null) {
                XDocument external_style_doc = HelperFunctions.DecompressXMLResource("Novacode.Resources.styles.xml.gz");

                var styleElement =
                    from e in external_style_doc.Descendants()
                    let styleId = e.Attribute(XName.Get("styleId", DocX.w.NamespaceName))
                    where (styleId != null && styleId.Value == val.Value)
                    select e

                Document.styles.Element(XName.Get("styles", DocX.w.NamespaceName)).Add(styleElement);