Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move the cursor to the particullar paragraph using Microsoft.Office.Interop.Word?

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?

like image 224
Saravanan Avatar asked Oct 10 '22 21:10

Saravanan


1 Answers

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();
}
like image 152
GSerg Avatar answered Oct 13 '22 09:10

GSerg