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

試著忘記壹切 提交于 2019-12-07 11:07:12

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/6186873/how-to-move-the-cursor-to-the-particullar-paragraph-using-microsoft-office-inter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!