我正在尝试使用VS2008创建word 2007加载项,我需要知道如何在word文档中获取所选文本
答案 0 :(得分:2)
我找到了解决方案:
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
public String getSelected(){
Word.Document app = add_in.Globals.ThisAddIn.Application.ActiveDocument;
String keyword = app.Application.Selection.Text;
return keyword;
}