コメント 
コメントはテキストフィールドの一種です。com.sun.star.text.textfield.Annotation サービスを利用します。
コメントの挿入 
一般的なフィールドと同じように挿入します。
0
1
2
3
4
5
6
7
8
| | Sub InsertComment
oDoc = ThisComponent
oText = oDoc.getText()
oComment = oDoc.createInstance("com.sun.star.text.textfield.Annotation")
oText.insertTextContent(oText.getStart(), oComment, False)
oComment.Content = "Comment"
End Sub
|
コメントに書式設定が必要であれば TextRange プロパティから行います。
ドキュメント中のコメントの取り扱い 
ドキュメントにあるコメント全てにアクセスします。テキストフィールドがコメントかどうかを判定する必要があります。
0
1
2
3
4
5
6
7
8
9
10
11
12
13
| | sub GetAllComments
oDoc = ThisComponent
oFields = oDoc.getTextFields()
oFieldEnume = oFields.createEnumeration()
While oFieldEnume.hasMoreElements()
oField = oFieldEnume.nextElement()
If oField.supportsService("com.sun.star.text.textfield.Annotation") Then
msgbox oField.Content
End If
WEnd
end sub
|
プロパティ 
プロパティ | 型 | 説明 |
AnchorType | css.text.TextContentAnchorType | アンカーの種類 |
AnchorTypes | []css.text.TextContentAnchorType | アンカーの種類複合時 |
Content | string | コメント文字列 |
TextRange | css.uno.XInterface | コメントのテキスト |
Author | string | コメントの著者 |
Date | css.util.Date | コメントの日付 |
DateTimeValue | css.util.DateTime | コメントの日付と時間 |
IsFieldDisplayed | boolean | |
IsFieldUsed | boolean | |
TextWrap | .text.WrapTextMode | テキスト回り込み |