public void MoveToParagraph( int paragraphIndex, int characterIndex )
Public Sub MoveToParagraph ( paragraphIndex As Integer, characterIndex As Integer )
public: void MoveToParagraph( int paragraphIndex, int characterIndex )
member MoveToParagraph : paragraphIndex : int * characterIndex : int -> unit
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.
// Open a document with a lot of paragraphs Document doc = new Document(MyDir + "Paragraphs.docx"); ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs; Assert.AreEqual(22, paragraphs.Count); // When we create a DocumentBuilder for a document, its cursor is at the very beginning of the document by default, // and any content added by the DocumentBuilder will just be prepended to the document DocumentBuilder builder = new DocumentBuilder(doc); Assert.AreEqual(0, paragraphs.IndexOf(builder.CurrentParagraph)); // We can manually move the DocumentBuilder to any paragraph in the document via a 0-based index like this builder.MoveToParagraph(2, 0); builder.Writeln("This is a new third paragraph. ");