von komma4 » So, 24.06.2007 11:59
kopiere den folgenden Code in ein Modul Deiner "Standard"-Bibliothek. Tipp: Angefragt war "Calc" - nimmt man die Filter-Anweisung raus, dann funktioniert das "Öffnen mit update aller Links/Verknüpfungen/Verzeichnisse" auch bei Writer:
Code: Alles auswählen
' oooinfo 12809
' 2007-06-23
Sub openCalcWithUpdate
' Create a FilePicker dialog.
oFileDialog = _
CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
' object for file services
oUcb = _
createUnoService("com.sun.star.ucb.SimpleFileAccess")
' set titel
oFileDialog.setTitle( "Öffnen von *.ods mit automatischem Update" )
' set up filter
oFileDialog.appendFilter( "OpenDocument Tabellendokument (*.ods)", "*.ods")
' pre-set your source path HERE
InitPath = ConvertToURL( "/zentrale/firma/data/" )
' pre-set source path
If oUcb.Exists( InitPath ) Then
oFileDialog.SetDisplayDirectory( InitPath )
End If
' Dialog anzeigen, ausführen Aktion bei OK
if oFileDialog.execute() = _
com.sun.star.ui.dialogs.ExecutableDialogResults.OK then
gesamteAuswahl = oFileDialog.getFiles()
Dim aFileProp( 0 ) as new com.sun.star.beans.PropertyValue
aFileProp( 0 ).name = "UpdateDocMode"
aFileProp( 0 ).value = 3 'full update
oDok = _
StarDesktop.loadComponentFromURL( _
gesamteAuswahl( 0 ) , _
"_blank", 0, aFileProp())
End If
End Sub
Viel Erfolg!
kopiere den folgenden Code in ein Modul Deiner "Standard"-Bibliothek. Tipp: Angefragt war "Calc" - nimmt man die Filter-Anweisung raus, dann funktioniert das "Öffnen mit update aller Links/Verknüpfungen/Verzeichnisse" auch bei Writer:[code]
' oooinfo 12809
' 2007-06-23
Sub openCalcWithUpdate
' Create a FilePicker dialog.
oFileDialog = _
CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
' object for file services
oUcb = _
createUnoService("com.sun.star.ucb.SimpleFileAccess")
' set titel
oFileDialog.setTitle( "Öffnen von *.ods mit automatischem Update" )
' set up filter
oFileDialog.appendFilter( "OpenDocument Tabellendokument (*.ods)", "*.ods")
' pre-set your source path HERE
InitPath = ConvertToURL( "/zentrale/firma/data/" )
' pre-set source path
If oUcb.Exists( InitPath ) Then
oFileDialog.SetDisplayDirectory( InitPath )
End If
' Dialog anzeigen, ausführen Aktion bei OK
if oFileDialog.execute() = _
com.sun.star.ui.dialogs.ExecutableDialogResults.OK then
gesamteAuswahl = oFileDialog.getFiles()
Dim aFileProp( 0 ) as new com.sun.star.beans.PropertyValue
aFileProp( 0 ).name = "UpdateDocMode"
aFileProp( 0 ).value = 3 'full update
oDok = _
StarDesktop.loadComponentFromURL( _
gesamteAuswahl( 0 ) , _
"_blank", 0, aFileProp())
End If
End Sub[/code]
Viel Erfolg!