DocumentBuilderMoveTo Method
Moves the cursor to an inline node or to the end of a paragraph.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.10
Syntax
public void MoveTo(
	Node node
)

Parameters

node
Type: Aspose.WordsNode
The node must be a paragraph or a direct child of a paragraph.
Remarks

When node is an inline-level node, the cursor is moved to this node and further content will be inserted before that node.

When node is a Paragraph, the cursor is moved to the end of the paragraph and further content will be inserted just before the paragraph break.

When node is a block-level node but not a Paragraph, the cursor is moved to the end of the first paragraph into block-level node and further content will be inserted just before the paragraph break.

Examples
Shows how to move a cursor position to a specified node.
[C#]

Document doc = new Document(MyDir + "DocumentBuilder.doc");
DocumentBuilder builder = new DocumentBuilder(doc);

builder.MoveTo(doc.FirstSection.Body.LastParagraph);
Examples
Shows how to move between nodes and manipulate current ones.
[C#]

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");
See Also