开发者

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

开发者 https://www.devze.com 2023-03-09 05:19 出处:网络
We are developing C#.Net 4.0 Windows form based application using Microsoft.Office.Interop.Word reference.

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

Now开发者_JS百科 I want to move the position of the cursor to the particular paragraph.

How I do it?


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();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消