SSブログ

LibreOffice CalcBasic コメント [LibreOffice Calc Basic]

LibreOffice CalcBasic コメント

セルにコメントを挿入してある場合、コメントマーク(セルに表示される赤い)の表示非表示

libreofficeCalcComment.png

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

 


タグ:コメント
nice!(10)  コメント(0)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 10

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

トラックバック 0


Linuxランキング

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。