public virtual IPrintObject GetCopyOf(IPrintObject sourcePrintObject) { if (TryGetCopyOfTable(sourcePrintObject)) { var lastTable = Tables.Item(Tables.Count); return(new PrintObject(lastTable.Table)); } var sourceObject = new PrintObject(XmlElement); return(sourceObject.GetCopyOf(sourcePrintObject)); }
public IPrintObject GetCopyOf(IPrintObject sourcePrintObject) { if (InternalTable == null) { return(null); } if (TryAppendCopyOfTable(sourcePrintObject)) { return(new PrintObject(InternalTable)); } var sourceObject = new PrintObject(XmlElement); return(sourceObject.GetCopyOf(sourcePrintObject)); }
public void GetCopyOfTableToFooter() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); var footer = doc.MainDocumentPart.FooterParts .Select(f => f.Footer) .LastOrDefault(); var source = new PrintObject(table.Table); var dest = new PrintObject(footer); Assert.AreEqual(footer.Descendants <Table>().Count(), 0); dest.GetCopyOf(source); Assert.AreEqual(footer.Descendants <Table>().Count(), 1); } }
public IPrintObject GetCopyOf(IPrintObject sourcePrintObject) { var sourceObject = new PrintObject(XmlElement); return(sourceObject.GetCopyOf(sourcePrintObject)); }