5

We are developing C#.Net 4.0 Windows form based application using Microsoft.Office.Interop.Word reference.

Now I want to move the position of the cursor to the particular paragraph.

How I do it?

Behzad
  • 3,314
  • 4
  • 36
  • 61
Saravanan
  • 11,084
  • 42
  • 137
  • 209

1 Answers1

4
void MoveToParagraph(Microsoft.Office.Interop.Word.Document d, int number)
{
    Microsoft.Office.Interop.Word.Range r = d.Paragraphs[number].Range;
    object dir = Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseStart;

    r.Collapse(ref dir);
    r.Select();
}
GSerg
  • 73,524
  • 17
  • 153
  • 317