OpenOffice Objects for OLE

Discuss setup / installation issues - Add a spell checker, Language pack?
Post Reply
Sued
Posts: 2
Joined: Mon Jul 14, 2008 6:14 pm

OpenOffice Objects for OLE

Post by Sued »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using? not using yet. Depends on these answer.
What Operating System (version) are you using? Windos XP
What is your question or comment?

Beyond of the natural use of Microsoft Office parts (Word, Excel...) we use instantiate them via OLE, to operate its facilities from inside others softwares. Our development is based on VisualFoxPro 9 and we frequently use this fact.
Considering the fondation Class "Word" registered in Windows we can do:

om=CREATEOBJECT([word.application])
IF TYPE([om])#[O]
MESSAGEBOX([WORD not Opened],16,[Error])
return
ENDIF

om.documents.open([..\docs\trans.doc])
om.visible=.t.
WITH om.ActiveDocument.Bookmarks
.Item([cliente]).Select
om.Selection.InsertAfter(clientes.nome)
.Item([endereco]).Select
om.Selection.InsertAfter(clientes.endereco)
.Item([bairro]).Select
om.Selection.InsertAfter(clientes.bairro)
.Item([cidade]).Select
om.Selection.InsertAfter(clientes.cidade)
.Item([uf]).Select
om.Selection.InsertAfter(clientes.estado)
.Item([telefone]).Select
om.Selection.InsertAfter(clientes.telefone)
.Item([nf]).Select
om.Selection.InsertAfter(notafiscal.nf)
.Item([quantidade]).Select
om.Selection.InsertAfter(notafiscal.quantidade)
.Item([caixas]).Select
om.Selection.InsertAfter(notafiscal.especie)
.Item([transport]).Select
om.Selection.InsertAfter(notafiscal.tnome)
ENDWITH
MESSAGEBOX([Imprima o TRANS e Click OK.],64,[NF])
om.quit

This works fine and the question we have is: Could we do something like this above with OpenOffice? How ?
If we could, many costumers wold migrate to OpenOffice.

Thanks
(sorry for my English) ;)
OOo 2.3.X on Ms Windows XP
User avatar
foxcole
Volunteer
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: OpenOffice Objects for OLE

Post by foxcole »

Your English is certainly good enough! :)

I'm sorry I can't answer your question specifically regarding code, so perhaps another user will jump in here, but I can at least say that OpenOffice.org does support OLE objects, except currently in the case of PDF files. OOo version 3.0 will be able to import PDFs as image objects, though, so they can at least be displayed. (OpenOffice OLE requires having a program installed that can edit the OLE object, because of course the purpose of OLE was to allow editing without having to leave the document... and most people don't have Adobe Acrobat to edit PDF files, so PDF OLE objects wouldn't work when the users tried to open the document. But with version 3.0, PDFs will be graphics, so they can open in the document without any additional software.)

Are you thinking of inserting OLE objects in OpenOffice format, or are you wondering about inserting MS Office formats? Both are possible. You can also create new blank OLE objects to be edited by the user, or insert an object from an existing file.

I hope that's at least enough to help decide whether to continue investigating OOo as a possible solution.
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
Sued
Posts: 2
Joined: Mon Jul 14, 2008 6:14 pm

Re: OpenOffice Objects for OLE

Post by Sued »

Well...somone undestood me a least!!! thanks ! :lol:
The code I´ve sent, do something like:
Instantiating an OLE Object in a variable "om" by specifiing the registered class word.application so that I can operate over an WORD document from my VisualFoxPro application. I do that with MS Word, MS Excell etc.

om=CREATEOBJECT([word.application])

the rest of the code is operations, operations...

My question is: There will have an registered class like (uhu..) "write.application" in my Windows, after OpenOffice Instalation allowing me instantiate an OLE object that create a document OO WRITE that works like the code I´ve sent?

It would be THE HAVEN!!! :idea:

Thanks, again.

Sued
OOo 2.3.X on Ms Windows XP
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: OpenOffice Objects for OLE

Post by acknak »

Maybe a programmer will answer here, but you may need to ask your question over in the Macros and UNO API fourm to get a better answer.

Anyway, I can tell you that you won't be able to use OLE to get access to OpenOffice.org (OOo) functions: OLE is not an open standard technology, it's purely proprietary to MS and WIndows. OOo uses open standards and has to work the same on every platform it supports, and OLE is not going to do that.

Instead, OOo uses a technology called "UNO", which provides similar capabilities as OLE,except it supports all the platforms (PC, Mac, Unix & Linux) and is open source.

I seem to remember that there is some kind of UNO/OLE bridge component available for Windows, if you need to call out to some Windows application that only has OLE, but it's not for calling OOo. At least that's my (very limited) knowledge of it, and I may well be wrong.

Hopefully someone else will show up here with some better information.
AOO4/LO5 • Linux • Fedora 23
User avatar
foxcole
Volunteer
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: OpenOffice Objects for OLE

Post by foxcole »

acknak wrote:I seem to remember that there is some kind of UNO/OLE bridge component available for Windows, if you need to call out to some Windows application that only has OLE
There is some compatibility, because a Word document with an Excel OLE object can be opened in OOo... though care has to be taken to set up the load and save options so the file and its inserted object are converted to and from OOo correctly. (So, for example, if you're working with MS Office users and assuming they have a Word document with an Excel embedded object, you want to select the Load options for Word and Excel so they're converted to Writer and Cald, and the and Save options for Word and Excel so they're converted back to Word and Excel.) Other than that, embedding an OLE/UNO object translates smoothly between the two suites.
 Edit: I just ran across a post from a few months ago that asked a question and received no replies... but it also contains some interesting information, as well as a title of another related thread that might also prove useful:
Using OO as an OLE Server 
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
Post Reply