如何将光标移动到使用的Microsoft.Office.Interop.Word所述particullar段? [英] How to move the cursor to the particullar paragraph using MicroSoft.office.interop.Word?

查看:184
本文介绍了如何将光标移动到使用的Microsoft.Office.Interop.Word所述particullar段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发的C#.net4.0 Windows窗体的应用程序使用的Microsoft.Office.Interop.Word reference.Now我想光标的位置移动到特定paragraph.How我做到这一点?

解决方案

 无效MoveToParagraph(Microsoft.Office.Interop.Word.Document研发,INT数)
{
    Microsoft.Office.Interop.Word.Range R = d.Paragraphs [数字] .Range;
    对象DIR = Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseStart;

    r.Collapse(参考文献目录);
    r.Select();
}
 

We are developing C#.net4.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?

解决方案

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

这篇关于如何将光标移动到使用的Microsoft.Office.Interop.Word所述particullar段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆