von F3K Total » So, 01.12.2013 23:13
Hi,
habe was gestrickt:
Code: Alles auswählen
sub s_change_locale_DE_de
dim afiles(1,0) as string
dim array()
MyDialog=createunoservice("com.sun.star.ui.dialogs.FolderPicker")
myDialog.displaydirectory = "c:\"
if mydialog.execute = 0 then
exit sub
endif
sfolder = mydialog.directory
sURL = ConvertfromUrl(sfolder)+"\"
NextFile = Dir(sURL, 0)
afiles(0,0)= NextFile'Dateiname mit Extension
afiles(1,0)= Left(NextFile,Len(NextFile)-5)'Dateiname ohne Extension .docx
i = 1
While NextFile <> ""
on error goto EXITER
redim preserve afiles(1,i)
NextFile = Dir
afiles(0,i)= NextFile'Dateiname mit Extension
afiles(1,i)= Left(NextFile,Len(NextFile)-4)'Dateiname ohne Extension
i=i+1
Wend
EXITER:
Dim args(0) as New com.sun.star.beans.PropertyValue
args(0).Name = "Hidden"
args(0).Value = true
for i = 0 to ubound (afiles(),2)
surldocx = sfolder &"/"& afiles(0,i)
surlodt = sfolder &"/"& afiles(1,i) & ".odt"
odocument = StarDesktop.loadComponentFromURL(surldocx,"_blank", 0, args)
oCharLocale = odocument.CharLocale
with oCharLocale
.Language = "de"
.country = "DE"
end with
odocument.CharLocale = oCharLocale
odocument.storetourl(surlodt,array())
odocument.close -1
next i
msgbox "fertig, "+ (ubound (afiles(),2)+1) +" Dateien bearbeitet!"
end sub
Die Dateien werden im Hintergrund geöffnet, auf DE-de umgearbeitet und als .odt gespeichert.
Gruß R
Hi,
habe was gestrickt:
[code]sub s_change_locale_DE_de
dim afiles(1,0) as string
dim array()
MyDialog=createunoservice("com.sun.star.ui.dialogs.FolderPicker")
myDialog.displaydirectory = "c:\"
if mydialog.execute = 0 then
exit sub
endif
sfolder = mydialog.directory
sURL = ConvertfromUrl(sfolder)+"\"
NextFile = Dir(sURL, 0)
afiles(0,0)= NextFile'Dateiname mit Extension
afiles(1,0)= Left(NextFile,Len(NextFile)-5)'Dateiname ohne Extension .docx
i = 1
While NextFile <> ""
on error goto EXITER
redim preserve afiles(1,i)
NextFile = Dir
afiles(0,i)= NextFile'Dateiname mit Extension
afiles(1,i)= Left(NextFile,Len(NextFile)-4)'Dateiname ohne Extension
i=i+1
Wend
EXITER:
Dim args(0) as New com.sun.star.beans.PropertyValue
args(0).Name = "Hidden"
args(0).Value = true
for i = 0 to ubound (afiles(),2)
surldocx = sfolder &"/"& afiles(0,i)
surlodt = sfolder &"/"& afiles(1,i) & ".odt"
odocument = StarDesktop.loadComponentFromURL(surldocx,"_blank", 0, args)
oCharLocale = odocument.CharLocale
with oCharLocale
.Language = "de"
.country = "DE"
end with
odocument.CharLocale = oCharLocale
odocument.storetourl(surlodt,array())
odocument.close -1
next i
msgbox "fertig, "+ (ubound (afiles(),2)+1) +" Dateien bearbeitet!"
end sub[/code]
Die Dateien werden im Hintergrund geöffnet, auf DE-de umgearbeitet und als .odt gespeichert.
Gruß R