public void WorkingWithNodes()
{
//ExStart
//ExFor:DocumentBuilder.MoveTo(Node)
//ExFor:DocumentBuilder.MoveToBookmark(String)
//ExFor:DocumentBuilder.CurrentParagraph
//ExFor:DocumentBuilder.CurrentNode
//ExFor:DocumentBuilder.MoveToDocumentStart
//ExFor:DocumentBuilder.MoveToDocumentEnd
//ExSummary:Shows how to move between nodes and manipulate current ones.
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();
// 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]);
builder.CurrentNode.Range.Replace("bad", "good", false, true);
// Mark the beginning of the document.
builder.MoveToDocumentStart();
builder.Writeln("Start of document.");
// Mark the ending of the document.
builder.MoveToDocumentEnd();
builder.Writeln("End of document.");
doc.Save(MyDir + @"\Artifacts\DocumentBuilder.WorkingWithNodes.doc");
//ExEnd
}