DocumentBuilderIsAtEndOfParagraph Property |
Namespace: Aspose.Words
Document doc = new Document(MyDir + "DocumentBuilder.WorkingWithNodes.doc"); DocumentBuilder builder = new DocumentBuilder(doc); // Move to a bookmark and delete the parent paragraph. builder.MoveToBookmark("ParaToDelete"); builder.CurrentParagraph.Remove(); FindReplaceOptions options = new FindReplaceOptions { MatchCase = false, FindWholeWordsOnly = true }; // Move to a particular paragraph's run and replace all occurrences of "bad" with "good" within this run. builder.MoveTo(doc.LastSection.Body.Paragraphs[0].Runs[0]); Assert.IsTrue(builder.IsAtStartOfParagraph); Assert.IsFalse(builder.IsAtEndOfParagraph); builder.CurrentNode.Range.Replace("bad", "good", options); // Mark the beginning of the document. builder.MoveToDocumentStart(); builder.Writeln("Start of document."); // builder.WriteLn puts an end to its current paragraph after writing the text and starts a new one Assert.AreEqual(2, doc.FirstSection.Body.Paragraphs.Count); Assert.IsTrue(builder.IsAtStartOfParagraph); Assert.IsTrue(builder.IsAtEndOfParagraph); // builder.Write doesn't end the paragraph builder.Write("Second paragraph."); Assert.AreEqual(2, doc.FirstSection.Body.Paragraphs.Count); Assert.IsFalse(builder.IsAtStartOfParagraph); Assert.IsTrue(builder.IsAtEndOfParagraph); // Mark the ending of the document. builder.MoveToDocumentEnd(); builder.Writeln("End of document."); doc.Save(ArtifactsDir + "DocumentBuilder.WorkingWithNodes.doc");