DocumentBuilderMoveToParagraph Method

Moves the cursor to a paragraph in the current section.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
public void MoveToParagraph(
	int paragraphIndex,
	int characterIndex


Type: SystemInt32
The index of the paragraph to move to.
Type: SystemInt32
The index of the character inside the paragraph. Currently can only specify 0 to move to the beginning of the paragraph or -1 to move to the end of the paragraph.

The navigation is performed inside the current story of the current section. That is, if you moved the cursor to the primary header of the first section, then paragraphIndex specified the index of the paragraph inside that header of that section.

When paragraphIndex is greater than or equal to 0, it specifies an index from the beginning of the section with 0 being the first paragraph. When paragraphIndex is less than 0, it specified an index from the end of the section with -1 being the last paragraph.

Shows how to move a cursor position to the specified paragraph.
Document doc = new Document(MyDir + "Paragraphs.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

// Parameters are 0-index. Moves to third paragraph
builder.MoveToParagraph(2, 0);
builder.Writeln("Text added to the 3rd paragraph. ");
See Also