BBC BASIC for Windows
« COMLIB interfacinf with LibreOffice »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:58pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: COMLIB interfacinf with LibreOffice  (Read 441 times)
Edja
Developer

member is offline

Avatar




PM


Posts: 60
xx COMLIB interfacinf with LibreOffice
« Thread started on: Sep 2nd, 2014, 08:53am »

Quote:
PlanMaker automation demo, M.G.Marten 1 Sept 2014 + R.T.Russell 23 Apr 2007 Revised edition to use modified COMLIB Adapted from ActiveX (OLE automation) demonstration program using COMLIB For SoftMaker Software GmbH, PlanMaker and TextMaker (Excel and Word clones.}
I've looked at the code you've uploaded today to https://groups.yahoo.com/neo/groups/bb4w/files/Miscellaneous/PMactivex.bbc
Very interesting ! I am a user of LibreOffice.Writer and LibreOffice.Calc. Can these be interfaced too? I suppose I'll have to change lines 250 and 1950.
Code:
250 Pmapp% = FN_createobject("PlanMaker.Application")
and
1950 wdapp% = FN_createobject("TextMaker.Application") 
How should I go about (assuming this can work ?)

Eddy



User IP Logged

lancegary
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx Re: COMLIB interfacinf with LibreOffice
« Reply #1 on: Sep 2nd, 2014, 1:59pm »

Surely your code is for Softmaker Office 2012 rather than for Libre Office?

Lance
User IP Logged

Malvern
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #2 on: Sep 2nd, 2014, 2:39pm »

Quote:
How should I go about (assuming this can work ?)


If you can find the COM object model documented then that might be a clue. Otherwise you are dead in the water.
Libre may not be using COM. Since its origin is from Sun, the originators of Java, it is quite likely to be using a different technology and so it may not be possible at all.
COM is very much a C, C++ type interface.

V
User IP Logged

rtr2
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #3 on: Sep 2nd, 2014, 4:02pm »

on Sep 2nd, 2014, 2:39pm, Malvern wrote:
If you can find the COM object model documented then that might be a clue.

I think these details substantially apply to LibreOffice as well as OpenOffice:

https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge

Here are the instructions for installing the ActiveX control:

https://help.libreoffice.org/Common/ActiveX_Control_to_Display_Documents_in_Internet_Explorer
« Last Edit: Sep 2nd, 2014, 4:04pm by rtr2 » User IP Logged

Malvern
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #4 on: Sep 2nd, 2014, 9:21pm »

So as Richard shows there is a way via a bridge. I love the line in the linked document.
Quote:
A developer must learn which objects provide the desired functionality and how to obtain them.


Also in the Open Office docs is the statement:
Quote:
Also, there are no COM type libraries available...

So they haven't made it very easy for you.
Good luck, and do let us know if you have any success as there are probably quite a few Libre and Open office users out there. I suspect that COMLIB may be a hard route to follow. The built in BASIC macro language would be much easier as:-
Quote:
It hides the complexity of interfaces and simplifies the use of properties by making UNO objects look like Basic objects.


But If someone has time and would like to prove us all wrong...


V
« Last Edit: Sep 2nd, 2014, 9:33pm by Malvern » User IP Logged

Malcolm
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #5 on: Sep 2nd, 2014, 10:19pm »

Quote:
But If someone has time and would like to prove us all wrong...


Sorry can't help. SoftMaker was chosen as it has a very VBA like Macro language and has the COM Object model very well described, indeed much to easier access than Microsoft programs in recent years. Gone are the days when a full COM object map was an A0 sized fold out from the MS documentation pack. Yep, they did that many years ago!
It was a bonus to find that after not renewing MS Office there were programs that allowed me to do very similar automation things with BB4W. That is why I published the program in case anyone else happened to be in the same place (workspace?).

Malcolm.


User IP Logged

Malcolm
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #6 on: Sep 2nd, 2014, 11:40pm »

Wow, just realized that Yahoo links to the files works again. That's been missing for ages here.
It doesn't let me run them without downloading first but then again that's not something I would ever do for security reasons.
Pays to look first. Or am I being paranoid?
But now the files are not sorted by date or alphabetically!

Take care, and certainly don't trust any of my programs.

Malcolm.
User IP Logged

rtr2
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #7 on: Sep 3rd, 2014, 08:14am »

on Sep 2nd, 2014, 9:21pm, Malvern wrote:
But If someone has time and would like to prove us all wrong...

It should be easy enough to convert the Visual Basic code, listed on the OpenOffice site, to BBC BASIC. That would at least demonstrate whether LibreOffice has the same ActiveX interface.

If that works, more details of exactly what COM interfaces are provided can presumably be found by studying the relevant LibreOffice source file(s).

Definitely worth attempting, rather than being negative about the prospects.
User IP Logged

Edja
Developer

member is offline

Avatar




PM


Posts: 60
xx Re: COMLIB interfacinf with LibreOffice
« Reply #8 on: Sep 3rd, 2014, 09:37am »

Wow. Lots of info and links to docs that I will need to chew through. When I raised the question, I hoped it could be accomplished merely by changing a few lines in Marten's code. Not so.
About 2 years ago I wrote some code for my personal use that interfaced with Excel. Since then I switched to Libreoffice Calc and always wanted to try to do somethings similar
I will check all your feedback and give it a try. I'm a slow learner and most of your comments are new stuff to me. IF I manage to get something working I'll report back here. But don't expect results any time soon. Thanks for all your reactions ! ! !
Eddy
User IP Logged

Malvern
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #9 on: Sep 3rd, 2014, 3:22pm »

OK, All I was saying was it did not appear to be an easy conversion. And I for one would not have a clue what to do with this:
Code:
Dim args()
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter",_
                 "_blank", 0, args) 

Or even why from URL?
Do those that are wiser have any suggestions?

V
User IP Logged

rtr2
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #10 on: Sep 3rd, 2014, 4:49pm »

on Sep 3rd, 2014, 3:22pm, Malvern wrote:
I for one would not have a clue what to do with this

When you say you "would not have a clue" presumably you appreciate that loadComponentFromURL is a method of the object objDesktop (which is an instantiation of the class com.sun.star.frame.Desktop). As with all objects, one option is to call the method via the vTable, as described in this Wiki article:

http://bb4w.wikispaces.com/Calling+object+methods+using+structures

Alternatively, if it's an object which implements the iDispatch interface you can - more easily - call the method using COMLIB.BBC:

http://bb4w.wikispaces.com/Component+Object+Model+programming

Once upon a time a COM/ActiveX object could be guaranteed to have an iDispatch interface, but no longer apparently:

http://support.microsoft.com/kb/159621/en-us

I'm not knowledgeable enough about VBScript to say whether the code at the OpenOffice page implies the presence of an iDispatch interface or not.

Quote:
Or even why from URL?

That's probably a question it's better not to ask! Just do what it says. wink
User IP Logged

Malcolm
Guest
xx Re: COMLIB interfacinf with LibreOffice
« Reply #11 on: Sep 4th, 2014, 04:40am »

on Sep 3rd, 2014, 09:37am, Edja wrote:
Wow. Lots of info and links to docs that I will need to chew through.

I think you will find most of what you need is here:
https://www.openoffice.org/api/basic/man/tutorial/tutorial.pdf
Section 4.4 has some examples.

Malcolm
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls