Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to automate Open Office via OleAutomation?
How to automate Open Office via OleAutomation? [message #1063194] Wed, 12 June 2013 15:15
Norbert Neubauer is currently offline Norbert NeubauerFriend
Messages: 1
Registered: June 2013
Junior Member
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("")

'Create the CoreReflection service that is later used to create structs
Set objCoreReflection= objServiceManager.createInstance("")

'Create the Desktop
Set objDesktop= objServiceManager.createInstance("")

'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
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.
Previous Topic:Urgent Help needed regarding CSS mechanism in rcp application
Next Topic:SWT Scale - more than one selection
Goto Forum:

Current Time: Sat Jun 23 03:01:27 GMT 2018

Powered by FUDForum. Page generated in 0.01977 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top