在Outlook.mailItem中突出显示特定的Word.Range

时间:2013-09-20 18:15:28

标签: c# c#-4.0 outlook vsto outlook-2010

Outlook.Inspector = Globals.ThisAddIn.Application.ActiveInspector();
Word.Document document = (Word.Document)inspector.WordEditor;

//I have some code that determines start and end of the range i want to highlight.
//lets say they are:
object start = 0;
object end = 5;

Word.Range rng = document.Range(ref start, ref end);

//I have tried this but it didn't work but it throws an exception that Highlight 
//section is disabled or something like that.
rng.HighlightColorIndex  = WdColorIndex.wdYellow;

我还尝试从范围中获取文本并使用Word.Find对象并在此文本上使用Find.HitHighlight方法,但问题是它突出显示超出指定范围的文本外观。

任何帮助将受到高度赞赏!

0 个答案:

没有答案