CreateTable() статический приватный Метод

static private CreateTable ( int rowCount, int columnCount ) : System.Xml.Linq.XElement
rowCount int
columnCount int
Результат System.Xml.Linq.XElement
Пример #1
0
        public Table InsertTable(int index, int rowCount, int columnCount)
        {
            XElement newTable = HelperFunctions.CreateTable(rowCount, columnCount);

            Paragraph p = HelperFunctions.GetFirstParagraphEffectedByInsert(Document, index);

            if (p == null)
            {
                Xml.Elements().First().AddFirst(newTable);
            }

            else
            {
                XElement[] split = HelperFunctions.SplitParagraph(p, index - p.startIndex);

                p.Xml.ReplaceWith
                (
                    split[0],
                    newTable,
                    split[1]
                );
            }


            return(new Table(Document, newTable)
            {
                mainPart = mainPart
            });
        }
Пример #2
0
        public virtual Table InsertTable(int rowCount, int columnCount) //Dmitchern, changed to virtual, and overrided in Table.Cell
        {
            XElement newTable = HelperFunctions.CreateTable(rowCount, columnCount);

            Xml.Add(newTable);

            return(new Table(Document, newTable));
        }
Пример #3
0
        public virtual Table InsertTableBeforeSelf(int rowCount, int columnCount, TableLook tableLook = null)
        {
            XElement newTable = HelperFunctions.CreateTable(rowCount, columnCount, tableLook);

            Xml.AddBeforeSelf(newTable);
            XElement newlyInserted = Xml.ElementsBeforeSelf().Last();

            return(new Table(Document, newlyInserted));
        }
Пример #4
0
        public virtual Table InsertTableAfterSelf(int rowCount, int columnCount)
        {
            XElement newTable = HelperFunctions.CreateTable(rowCount, columnCount);

            Xml.AddAfterSelf(newTable);
            XElement newlyInserted = Xml.ElementsAfterSelf().First();

            return(new Table(Document, newlyInserted));
        }
Пример #5
0
        public virtual Table InsertTable(int rowCount, int columnCount)
        {
            XElement xElement = HelperFunctions.CreateTable(rowCount, columnCount);

            base.Xml.Add(xElement);
            return(new Table(base.Document, xElement)
            {
                mainPart = mainPart
            });
        }
Пример #6
0
        public virtual Table InsertTableBeforeSelf(int rowCount, int columnCount)
        {
            XElement newTable = HelperFunctions.CreateTable(rowCount, columnCount);

            Xml.AddBeforeSelf(newTable);
            XElement newlyInserted = Xml.ElementsBeforeSelf().Last();

            return(new Table(Document, newlyInserted)
            {
                mainPart = mainPart
            });
        }
Пример #7
0
        public virtual Table InsertTableAfterSelf(int rowCount, int columnCount)
        {
            XElement content = HelperFunctions.CreateTable(rowCount, columnCount);

            base.Xml.AddAfterSelf(content);
            XElement xml = base.Xml.ElementsAfterSelf().First();

            return(new Table(base.Document, xml)
            {
                mainPart = mainPart
            });
        }
Пример #8
0
        public Table InsertTable(int index, int rowCount, int columnCount)
        {
            XElement  xElement = HelperFunctions.CreateTable(rowCount, columnCount);
            Paragraph firstParagraphEffectedByInsert = HelperFunctions.GetFirstParagraphEffectedByInsert(base.Document, index);

            if (firstParagraphEffectedByInsert == null)
            {
                base.Xml.Elements().First().AddFirst(xElement);
            }
            else
            {
                XElement[] array = HelperFunctions.SplitParagraph(firstParagraphEffectedByInsert, index - firstParagraphEffectedByInsert.startIndex);
                firstParagraphEffectedByInsert.Xml.ReplaceWith(array[0], xElement, array[1]);
            }
            return(new Table(base.Document, xElement)
            {
                mainPart = mainPart
            });
        }