我想突出显示使用VSTO在Microsoft Word 2010中出现的给定字符串。
到目前为止,我已经使用该Find
工具成功设置了匹配项的前景色:
Word.Find find = Application.ActiveDocument.Content.Find;
find.Replacement.Font.ColorIndexBi = Word.WdColorIndex.wdYellow;
find.Execute(FindText: "dog", MatchCase: false, Replace: Word.WdReplace.wdReplaceAll);
但是,我想为比赛设置亮点,如下面的屏幕截图所示:
通过使用设置高光颜色
Application.Options.DefaultHighlightColorIndex
到wdColorIndex成员之一(例如wdYellow)
在“替换为”中应用突出显示颜色
find.Replacement.Highlight = True
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句