I am trying to start and automate Open Office in Java applet with SWT and OleAutomation. I know how to open document in OLE, however I have no clue how to do automation. In case of MS Word the object responsible for that was Word.Application, it doesn't seem to work the same way in case of Open Office.
In Open Office SDK, there is an example written in vbs.
'The service manager is always the starting point
'If there is no office running then an office is started up
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")
'Create the CoreReflection service that is later used to create structs
Set objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
'Create the Desktop
Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Open a new empty writer document
Dim args()
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
'Create a text object
Set objText= objDocument.getText
'Create a cursor object
Set objCursor= objText.createTextCursor
'Inserting some Text
objText.insertString objCursor, "The first line in the newly created text document." & vbLf, false
'Inserting a second line
objText.insertString objCursor, "Now we're in the second line", false
...
I don't know how to create and use com.sun.star.ServiceManager
I hope you could help me porting this code so I can run it in JAVA and SWT.
Please note that UNO is not a solution for me.
Thank you in advance.