Rebonjour,
Si tu peux nous faire passer le code de ce que tu auras compulsé, nous
pourrons le proposer au comme contribution au projet OOo sous la forme
d'un how-to. :-)
Quelques idées :
1 ) Pour retrouver les objets BasicLibraries et DialogLibraries du
conteneur soffice
oBasicLibraries =
CreateUnoService("com.sun.star.script.ApplicationScriptLibraryContainer")
oDialogLibraries =
CreateUnoService("com.sun.star.script.ApplicationDialogLibraryContainer")
2) Pour contrôler les droits d'écriture dans un répertoire: Merci à L.
Godard
Public Function ControleDroits(ByVal LeChemin As String) As Boolean
On Error GoTo PasDroit
LeChemin = LeChemin + "\temp.txt"
Dim file As System.IO.FileStream
file = System.IO.File.Create(LeChemin)
file.Close()
Kill(LeChemin)
ControleDroits = True
Exit Function
PasDroit:
ControleDroits = False
End Function
3) ConvertFromURL :
Public Function ConvertFromUrl(ByVal strFile As String) As String
strFile = Replace(strFile, "file:///", "")
strFile = Replace(strFile, "/", "\")
strFile = Replace(strFile, "|", ":")
strFile = Replace(strFile, "%20", " ")
ConvertFromUrl = strFile
End Function
4) Cette Fonction retourne le chemin OOo. Paramètres possibles : home,
work, inst, prog ...
Public Function GetRepertoirePath(ByVal sInstPath As String) As String
'donne le répertoire correspondant
Dim oPathSubstSrv As Object
Dim sPath As String
sInstPath = "$(" + sInstPath + ")"
oPathSubstSrv =
CreateUnoService("com.sun.star.comp.framework.PathSubstitution")
sPath = oPathSubstSrv.getSubstituteVariableValue(sInstPath)
GetRepertoirePath = sPath
End Function
5) Public Function CreateUnoService(ByVal strServiceName As String) As
Object
Dim oServiceManager As Object
oServiceManager = CreateObject("com.sun.star.ServiceManager")
CreateUnoService = oServiceManager.createInstance(strServiceName)
End Function
6) Pour fermer le OOo et le Quickstarter
Sub CloseOOo()
Dim I As Integer
Dim prc As System.Diagnostics.Process() =
Process.GetProcessesByName("soffice.bin")
For I = LBound(prc) To UBound(prc)
prc(I).CloseMainWindow()
prc(I).Kill()
prc(I).Close()
Next
prc = Nothing
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]