Ms word 如何更改Word VSTO中注释的文本背景色?

Ms word 如何更改Word VSTO中注释的文本背景色?,ms-word,vsto,office-addins,Ms Word,Vsto,Office Addins,我试图更改Word VSTO(2013)中注释对象的文本,但无论出于何种原因,我无法通过Application.ActiveDocument.Range(int,int)或Comment.Reference.Find.Execute(text)选择文本。尽管这两个操作在调用.select()方法后都“起作用”,但没有选择任何内容。那么,如何在Word VSTO中改变注释的字体或文本颜色呢 您需要通过Comment.Range对象访问它,而不是Comment.Reference。例如 Commen

我试图更改Word VSTO(2013)中注释对象的文本,但无论出于何种原因,我无法通过Application.ActiveDocument.Range(int,int)或Comment.Reference.Find.Execute(text)选择文本。尽管这两个操作在调用.select()方法后都“起作用”,但没有选择任何内容。那么,如何在Word VSTO中改变注释的字体或文本颜色呢


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

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

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