예제 #1
0
        public void TestAddParagraph()
        {
            XWPFDocument doc = XWPFTestDataSamples.OpenSampleDocument("sample.docx");

            Assert.AreEqual(3, doc.Paragraphs.Count);

            XWPFParagraph p = doc.CreateParagraph();

            Assert.AreEqual(p, doc.Paragraphs[(3)]);
            Assert.AreEqual(4, doc.Paragraphs.Count);

            Assert.AreEqual(3, doc.GetParagraphPos(3));
            Assert.AreEqual(3, doc.GetPosOfParagraph(p));

            //CTP ctp = p.CTP;
            //XWPFParagraph newP = doc.GetParagraph(ctp);
            //Assert.AreSame(p, newP);
            //XmlCursor cursor = doc.Document.Body.GetPArray(0).newCursor();
            //XWPFParagraph cP = doc.InsertNewParagraph(cursor);
            //Assert.AreSame(cP, doc.Paragraphs[(0)]);
            //Assert.AreEqual(5, doc.Paragraphs.Count);
        }