Openoffice macro ods convert csv
sub Main
rem define variables
dim document as object
dim dispatcher as object
dim URLStr as String
dim FileName as String
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
dim args1(2) as new com.sun.star.beans.PropertyValue
rem ———————————————————————-
GlobalScope.BasicLibraries.LoadLibrary(“Tools”)
URLStr = ThisComponent.getURL()
FileName = FileNameOutOfPath(URLStr)
URLStr = left(URLStr, len(URLStr)-4) & “.csv”
FileName = left(FileName, len(FileName)-4) & “.csv”
‘URLStr =mid(URLStr,1,32) & FileName ‘
print “URL=” & URLStr ‘msgbox(“URL=”+URLStr)
rem print FileName
‘msgbox(“asssssssssa”+FileName)
args1(0).Name = “URL”
args1(0).Value = URLStr
‘args1(0).Value = “file:///home/xinji/Desktop/tt/xinji.csv”
args1(1).Name = “FilterName”
‘args1(1).Value = FileName
args1(1).value = “Text – txt – csv (StarCalc)”
args1(2).Name = “FilterOptions”
args1(2).Value = “44,34,76,1”
‘args1(2).Name = “59,34,76,1”
‘args1(2).Name = “44,0,ANSI,1”
dispatcher.executeDispatch(document, “.uno:SaveAs”, “”, 0, args1())
ThisComponent.close(True)
end sub
关注公众号『长空雪』
搬孕工 分享孕妇写真 关注我微信公众号 长空雪 “情而不色”是我公众号的风格