示例#1
0
        public void TestAddPicture()
        {
            XWPFDocument  doc = XWPFTestDataSamples.OpenSampleDocument("TestDocument.docx");
            XWPFParagraph p   = doc.GetParagraphArray(2);
            XWPFRun       r   = p.GetRuns()[0];

            Assert.AreEqual(0, doc.AllPictures.Count);
            Assert.AreEqual(0, r.GetEmbeddedPictures().Count);

            r.AddPicture(new MemoryStream(new byte[0]), (int)PictureType.JPEG, "test.jpg", 21, 32);

            Assert.AreEqual(1, doc.AllPictures.Count);
            Assert.AreEqual(1, r.GetEmbeddedPictures().Count);
        }