Fonction CreateUnoService

Crée une instance d'un service Uno à l'aide de ProcessServiceManager.

Syntaxe :

oService = CreateUnoService (nom de service Uno)

Pour une liste des services disponibles, aller à : https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star.html

Exemples :

oIntrospection = CreateUnoService( "com.sun.star.beans.Introspection" )

Le code suivant utilise un service pour ouvrir la boîte de dialogue d'ouverture de fichier :

Sub Main

    fName = FileOpenDialog ("Veuillez sélectionner un fichier")

    Print "fichier sélectionné : "+Nomf

End Sub

 

Function FileOpenDialog(title As String) As String

    filepicker = createUnoService("com.sun.star.ui.dialogs.FilePicker")

    filepicker.Title = title

    filepicker.execute()

    files = filepicker.getFiles()

    FileOpenDialog=files(0)

End Function