Jump to content

マクロ/Writer/ba001

From The Document Foundation Wiki
This page is a translated version of the page Macros/Writer/ba001 and the translation is 100% complete.


説明

現在のドキュメントのカーソル位置に文字列を挿入します。

Basic コード

Sub insert_in_cursor_position()
    data = "Hello World with Basic"

    REM 現在のドキュメント
    doc = ThisComponent

    REM 現在の選択範囲は常に範囲を返し、終端を取得します。
    text = doc.CurrentSelection.getByIndex(0).End
    
    REM データを書き込む
    text.String = data    
End Sub


References to API

リンク
5 com.sun.star.text.TextDocument
8, 11 com.sun.star.text.XTextRange