2017-01-28 68 views
1

我试图改变Word VSTO(2013)中的评论对象的文本,但无论什么原因,我无法通过Application.ActiveDocument.Range(int,int)或comment.Reference.Find.Execute(文本)。尽管之后调用.select()方法时两个操作都“有效”,但没有选择任何操作。那么如何才能实现改变Word中VSTO注释的字体或文本颜色?如何更改Word中VSTO注释的文本背景颜色?

enter image description here

回答

1

您需要通过Comment.Range对象,而不是Comment.Reference访问它。例如。

Comments[1].Range.Font.Shading.BackgroundPatternColor = WdColor.wdColorDarkTeal; 

Comments[1].Range.HighlightColorIndex = WdColorIndex.wdYellow;