public virtual Table InsertTable(int rowCount, int columnCount) { var newTable = HelperFunctions.CreateTable(rowCount, columnCount); Xml.Add(newTable); var table = new Table(this.Document, newTable); table.PackagePart = this.PackagePart; return(table); }
public virtual Table InsertTableBeforeSelf(int rowCount, int columnCount) { var newTable = HelperFunctions.CreateTable(rowCount, columnCount); this.Xml.AddBeforeSelf(newTable); var newlyInserted = this.Xml.ElementsBeforeSelf().Last(); var table = new Table(this.Document, newlyInserted); table.PackagePart = this.PackagePart; return(table); }
public virtual Table InsertTable(int index, int rowCount, int columnCount) { var newTable = HelperFunctions.CreateTable(rowCount, columnCount); var p = HelperFunctions.GetFirstParagraphEffectedByInsert(Document, index); if (p == null) { Xml.Elements().First().AddFirst(newTable); } else { var split = HelperFunctions.SplitParagraph(p, index - p._startIndex); p.Xml.ReplaceWith(split[0], newTable, split[1]); } var table = new Table(this.Document, newTable); table.PackagePart = this.PackagePart; return(table); }