Jump to content

Macros/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.


Descrizione

Inserisce una stringa nella posizione del cursore in un documento corrente.

Codice in Basic

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

    REM Documento attuale
    doc = ThisComponent

    REM La selezione corrente restituisce sempre un intervallo e arriva alla fine
    text = doc.CurrentSelection.getByIndex(0).End
    
    REM Scrive i dati
    text.String = data    
End Sub


References to API

Line Link
5 com.sun.star.text.TextDocument
8, 11 com.sun.star.text.XTextRange