von Stephan » Do, 20.11.2014 06:54
Dann wirst Du wohl ein Makro verwenden müssen, z.B.:
Code: Alles auswählen
Sub text_codiert_oeffnen()
oFileDialog = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
With oFileDialog
.appendFilter( "Textdatei (txt)", "*.txt" )
.execute()
sUrl = .Files(0)
End With
Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
FileProperties(0).Name = "FilterName"
FileProperties(0).Value ="Text (encoded)"
FileProperties(1).Name = "FilterOptions"
FileProperties(1).Value ="APPLE_ROMAN,CR,Times New Roman,de-DE,"
oTXT = StarDesktop.loadComponentFromURL(sUrl, "_blank", 0, FileProperties())
End Sub
Die im Makro verwendeten Werte für Filternamen und FilterOptions kannst Du bei einer vorher händisch geöffneten Datei so auslesen:
Code: Alles auswählen
Sub showFilterOptions
Dim args(),i%
args() = thisComponent.getArgs
for i = 0 to uBound(Args())
if args(i).Name = "FilterName" then inputbox "","",args(i).value
if args(i).Name = "FilterOptions" then inputbox "","",args(i).value
next
End Sub
GRuß
Stephan
Dann wirst Du wohl ein Makro verwenden müssen, z.B.:
[code]Sub text_codiert_oeffnen()
oFileDialog = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
With oFileDialog
.appendFilter( "Textdatei (txt)", "*.txt" )
.execute()
sUrl = .Files(0)
End With
Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
FileProperties(0).Name = "FilterName"
FileProperties(0).Value ="Text (encoded)"
FileProperties(1).Name = "FilterOptions"
FileProperties(1).Value ="APPLE_ROMAN,CR,Times New Roman,de-DE,"
oTXT = StarDesktop.loadComponentFromURL(sUrl, "_blank", 0, FileProperties())
End Sub[/code]
Die im Makro verwendeten Werte für Filternamen und FilterOptions kannst Du bei einer vorher händisch geöffneten Datei so auslesen:
[code]Sub showFilterOptions
Dim args(),i%
args() = thisComponent.getArgs
for i = 0 to uBound(Args())
if args(i).Name = "FilterName" then inputbox "","",args(i).value
if args(i).Name = "FilterOptions" then inputbox "","",args(i).value
next
End Sub
[/code]
GRuß
Stephan