* コメント [#pc44f881] コメントはテキストフィールドの一種です。com.sun.star.text.textfield.Annotation サービスを利用します。 #contents ** コメントの挿入 [#c79d7469] 一般的なフィールドと同じように挿入します。 #code(basic){{ Sub InsertComment oDoc = ThisComponent oText = oDoc.getText() ' new comment field oComment = oDoc.createInstance("com.sun.star.text.textfield.Annotation") oText.insertTextContent(oText.getStart(), oComment, False) oComment.Content = "Comment" End Sub }} コメントに書式設定が必要であれば TextRange プロパティから行います。 ** ドキュメント中のコメントの取り扱い [#s281e0f3] ドキュメントにあるコメント全てにアクセスします。テキストフィールドがコメントかどうかを判定する必要があります。 #code(basic){{ 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 ' do something msgbox oField.Content End If WEnd end sub }} ** プロパティ [#jbca2f0e] |プロパティ|型|説明|h |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|テキスト回り込み| |