这可能看起来很琐碎,但就我的生活而言,我不知道如何更改评论框的字体属性。VBA代码的示例是:
Sub SetCommentsProperties()
Dim Cell As Range
For Each Cell In Selection
If Not Cell.Comment Is Nothing Then
With Cell.Comment.Shape.TextFrame.Characters.Font
.ColorIndex = 3
.Size = 12
.Name = "Arial Black"
End With
End If
Next Cell
End Sub
然而,在C#VSTO中,我只能达到
Cell.Comment.Shape.TextFrame.Characters()
这对我有效:
var selection = Globals.ThisAddIn.Application.Selection as Range;
var textFrame = selection.Comment.Shape.TextFrame;
textFrame.Characters().Font.ColorIndex = 3;
textFrame.Characters().Font.Size = 30;
您可以在此处看到Characters类的所有成员。