DocumentBuilderIsAtEndOfParagraph Property

Returns true if the cursor is at the end of the current paragraph.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public bool IsAtEndOfParagraph { get; }

Property Value

Type: Boolean
Examples
Shows how to move between nodes and manipulate current ones.
Document doc = new Document(MyDir + "Bookmarks.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

// Move to a bookmark and delete the parent paragraph
builder.MoveToBookmark("MyBookmark1");
builder.CurrentParagraph.Remove();

FindReplaceOptions options = new FindReplaceOptions
{
    MatchCase = false,
    FindWholeWordsOnly = true
};

// Move to a particular paragraph's run and use replacement to change its text contents
// from "Third bookmark." to "My third bookmark."
builder.MoveTo(doc.LastSection.Body.Paragraphs[1].Runs[0]);
Assert.IsTrue(builder.IsAtStartOfParagraph);
Assert.IsFalse(builder.IsAtEndOfParagraph);
builder.CurrentNode.Range.Replace("Third", "My third", 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(3, doc.FirstSection.Body.Paragraphs.Count);
Assert.IsTrue(builder.IsAtStartOfParagraph);
Assert.IsFalse(builder.IsAtEndOfParagraph);

// builder.Write doesn't end the paragraph
builder.Write("Second paragraph.");

Assert.AreEqual(3, doc.FirstSection.Body.Paragraphs.Count);
Assert.IsFalse(builder.IsAtStartOfParagraph);
Assert.IsFalse(builder.IsAtEndOfParagraph);

// Mark the ending of the document
builder.MoveToDocumentEnd();
builder.Write("End of document.");
Assert.IsFalse(builder.IsAtStartOfParagraph);
Assert.IsTrue(builder.IsAtEndOfParagraph);

doc.Save(ArtifactsDir + "DocumentBuilder.WorkingWithNodes.doc");
See Also