OLE Automation problems

Java, C++, C#, Delphi, ??? - Using the UNO bridges

OLE Automation problems

Postby vcaselli » Mon Nov 28, 2011 10:32 am

Hi all,
we are having problems while embedding an ODT Editor (LibreOffice or OpenOffice Writer) inside an external application (Eclipse RCP in our case) via OLE Automation.
In the past we successfully did it with MS Word using ClassID="Word.Document".
Now we tried with LibreOffice, but did not find the correspondent ClassID.
Someone can help?
Thank you

Vincenzo Caselli
LibreOffice 3.4.4 - Windows7
Posts: 2
Joined: Mon Nov 28, 2011 10:10 am

Re: OLE Automation problems

Postby B Marcelly » Mon Nov 28, 2011 12:37 pm

The Automation object for OpenOffice is "com.sun.star.ServiceManager"

Documentation : see Automation Bridge.

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
B Marcelly
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: OLE Automation problems

Postby vcaselli » Mon Nov 28, 2011 4:19 pm

I did several trials. Here is what I get:

a) with OpenOffice:
using "com.sun.star.ServiceManager" I get the message "Class ID not found in registry", while "opendocument.WriterDocument.1" is working.
The problem here is another: I cannot edit and succesfully save the doc (no errors, but the file on the file system remains unchanged).

b) with LibreOffice (in the hope that it's OLE can do better):
did not find any valid ClassID, I always get the message "Class ID not found in registry"

is anyone having success using LibreOffice OLE (solution b) or is able to save a doc using OpenOffice OLE (solution a) ?

Thank you
LibreOffice 3.4.4 - Windows7
Posts: 2
Joined: Mon Nov 28, 2011 10:10 am

Re: OLE Automation problems

Postby rudolfo » Mon Nov 28, 2011 7:12 pm

vcaselli, have you read the document refered by Bernard Marcelly? They state there:
Developer Guide: Automation Bridge wrote:The name Automation Bridge implies the use of the Automation technology. Automation is part of the collection of technologies commonly referred to as ActiveX or OLE, therefore the term OLE Bridge is misleading and should be avoided. Sometimes the bridge is called COM bridge, which is also wrong, since the only interfaces which are processed by the bridge are IUnknown and IDispatch.

In other words there is no typelib for the OpenOffice COM Objects. For me it seems a bit like your app that uses the Automation interface of OOo requires more then IUnknown and IDispatch.
In VisualBasic(Script) (or JScript) you would start with:
Code: Select all   Expand viewCollapse view
Set ie = CreateObject("InternetExplorer.Application")    ' For Internet Explorer
Set WSHShell = CreateObject("WScript.Shell")             ' For Scripting Host Shell Object
Set objWord = CreateObject("Word.Application")           ' For Word
Set oServiceManager = CreateObject("com.sun.star.ServiceManager") ' For OpenOffice

The crucial difference is that the first 3 all have a registry key with the same name under HKEY_CLASSES_ROOT and with a CLSID subkey. You won't find something for "com.sun.star.ServiceManager". Still if used with CreateObject all 4 COM objects will be instantiated.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests