问题描述
|
我们正在使用
Microsoft.Office.Interop.Word
参考开发C#.Net 4.0
Windows窗体应用程序。
现在,我想将光标的位置移动到特定的段落。
我该怎么做?
解决方法
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();
}