CreateTable() 정적인 개인적인 메소드

static private CreateTable ( int rowCount, int columnCount ) : System.Xml.Linq.XElement
rowCount int
columnCount int
리턴 System.Xml.Linq.XElement
예제 #1
0
파일: Container.cs 프로젝트: ruo2012/DocX
        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
            });
        }