Sub ExampleDir3
oDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", "_blank", 0, Array() )
oText = oDoc.getText()
oCursor = oText.createTextCursor()
Dim sFileName As String
Dim sPath
sPath = "C:\2011-01-13-1349-02\"
StringA = "JPG-Bilder in """ + sPath + """<BR><BR>" + CHR$(13)
oText.insertString( oCursor, StringA, False )
sFileName = Dir(sPath + "*.jpg")
Do While (sFileName <> "")
StringA = sFileName + "<BR>" + CHR$(13) + "<IMG SRC=""" + sPath + sFileName + """ WIDTH=50%> <BR> <BR>" + CHR$(13)
oText.insertString( oCursor, StringA, False )
sFileName = Dir()
Loop
rem ----------------------------------------------------------------------
rem define variables
' dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
' document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///C:/2011-01-13-1349-02/Verzeichnis mit OO-Basic A5.txt"
args1(1).Name = "FilterName"
args1(1).Value = "writer8"
dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:SaveAs", "", 0, args1())
End Sub
Es funktioniert auch. Der Dateityp ist aber nicht txt, sondern odt, trotz der Erweiterung ".txt". Hängt das vom Parameter "writer8" ab? Wie kann ich es ändern?
Hallo
Den Teil zur Speicherung hast du doch aus einer Makroaufzeichnung - was könnte man bei der Makroaufzeichnung tun damit ins gewünschte Format gespeichert wird ? ...Richtig, man wählt das gewünschte Format aus.
Gruß Karo
LO7.4.7.2debian 12(bookworm) auf Raspberry5 8GB (ARM64) LO25.2.3.2 flatpakdebian 12(bookworm) auf Raspberry5 8GB (ARM64)