von Jonny1 » Fr, 15.04.2011 23:31
Die Prozedur habe ich so geändert::
Code: Alles auswählen
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?
Danke
Die Prozedur habe ich so geändert::
[code]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
[/code]
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?
Danke