LibreOffice CalcBasic コメント [LibreOffice Calc Basic]
LibreOffice CalcBasic コメント
セルにコメントを挿入してある場合、コメントマーク(セルに表示される赤い■)の表示非表示
Sub CommentMarkShow()
'コメントマークの表示非表示
if ThisComponent.CurrentController.ShowNotes=True Then
'コメントマークを非表示
ThisComponent.CurrentController.ShowNotes = False
'ステータスバーにコメント表示
msg="コメントマークを非表示にしました!"
ThisComponent.CurrentController.getFrame.createStatusIndicator.start(msg,10)
Else
'コメントマークを表示
ThisComponent.CurrentController.ShowNotes = True
msg="コメントマークを表示にしました!"
'ステータスバーにコメント表示
ThisComponent.CurrentController.getFrame.createStatusIndicator.start(msg,10)
End If
'ステータスバーの表示を消す
wait 2000
ThisComponent.CurrentController.getFrame.createStatusIndicator.start("",10)
End Sub
全コメント表示
Sub Show_AllComments()
'アクティブシートのコメント全て表示するマクロ
'
Dim oEnum As Object
If ThisComponent.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) Then
oEnum = ThisComponent.CurrentController.getActiveSheet().getAnnotations().createEnumeration()
While oEnum.hasMoreElements()
oEnum.nextElement().setIsVisible(true)
WEnd
End If
End Sub
全コメント非表示
Sub hide_AllComments()
'アクティブシートのコメント全て非表示にするマクロ
'
Dim oEnum As Object
If ThisComponent.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) Then
oEnum = ThisComponent.CurrentController.getActiveSheet().getAnnotations().createEnumeration()
While oEnum.hasMoreElements()
oEnum.nextElement().setIsVisible(false)
WEnd
End If
End Sub
追記
全コメントの削除
Sub rm_AllComments()
'アクティブシートのコメントの削除
Dim oSheet As Object
Dim oAnnos As Object
If ThisComponent.supportsService( _
"com.sun.star.sheet.SpreadsheetDocument" ) Then
oAnnos = ThisComponent.CurrentController.getActiveSheet().getAnnotations()
'Print oAnnos.getCount
For i = 0 To oAnnos.getCount -1
'削除されると、indexNumberが変わるらしいので、removeByIndex(i)
'ではなく、removeByIndex(0)
oAnnos.removeByIndex(0)
Next i
End If
End Sub
コメント 0