public void TestSearchTextNotFound() { XWPFDocument doc = new XWPFDocument(); XWPFParagraph p = doc.CreateParagraph(); Assert.IsNull(p.SearchText("test", new PositionInParagraph())); Assert.AreEqual("", p.Text); }
public void TestSearchTextFound() { XWPFDocument xml = XWPFTestDataSamples.OpenSampleDocument("ThreeColHead.docx"); IList <XWPFParagraph> ps = xml.Paragraphs; Assert.AreEqual(10, ps.Count); XWPFParagraph p = ps[(0)]; TextSegement segment = p.SearchText("sample word document", new PositionInParagraph()); Assert.IsNotNull(segment); Assert.AreEqual("sample word document", p.GetText(segment)); Assert.IsTrue(p.RemoveRun(0)); }