[Gambas-user] Anybody have an example using DCOP?

Benoit Minisini gambas at ...1...
Tue Jan 10 18:22:28 CET 2006


On Tuesday 10 January 2006 18:10, johnf wrote:
> On Tuesday 10 January 2006 01:29, ron wrote:
> > On Tuesday 10 January 2006 04:22, johnf wrote:
> > > On Monday 09 January 2006 19:11, johnf wrote:
> > > > Hi,
> > > > I did not find an example of using DCOP anywhere (or am I just
> > > > missing it). I'd like to run kword.
> > > >
> > > > Thanks
> > > > John
> > >
> > > Ok I just found kate (I did not know what kate was until now because I
> > > didn't notice it was on the list of demo's).  But where can I find out
> > > about the functions for kword - like the functions found in the kate
> > > demo?
> > >
> > > John
> >
> > You can use 'kdcop' to see something, but how exactly to use and
> > then with gambas is not pretty to find.
> >
> > For dcop main info you must go to developer.kde.org is my best guess
>
> I have discovered that kdcop does not display anything with respect to
> "kword".  

You must launch kword so that it is displayed in the kdcop list.

> But I did find an old article describing how to use the dcop at 
> the command line.  Later I'll provide a few commands for dcop.
>
> But here is the basic issue.  I need some sort of report writer that will
> provide an invoice, and general reports.  It has to work (or made to work)
> with a result object.  So I decided I would first check into the word
> processors for Linux (OpenOffice and Kword).  In the windows world working
> with word processors is easy and I thought I could do the same with Linux.
> But what I'm discovering is a real mess.  Kword uses "dcop" and looks like
> it might work.  But kword has at least two issues:
> 1.  It is not the current leader - OpenOffice is.
> 2.  It is based on frames and not the standard text as other word
> processors. 3.  (not sure this is right) It appears that dcop will be
> replaced with dbus.
>
> OpenOffice also has several ways to be automated.
> 1. Use UNO - something I don't understand and find it hard to follow the
> programming examples (mostly the C++ stuff).
>
> 2. Star basic - but again find little information - but it still looks like
> I need to at least use some sort of UNO call to start the process.
>
> 3. There is something called URE that is a compiled and a run time version
> of UNO.  Again almost no information.
>
> The problem that worries me the most is the issue of getting a wrapper into
> Gambas for either UNO or URE.
>
> So what do I do?  That is the question!  Anyone have a suggestion?

Yes :-)

The simpler for me (and I would do that if I had to make a report) is to make 
an OpenOffice document that you will use as a template, by putting some 
markups inside where you want to put your data.

Then you save your document, you take the resulting file, you unzip it, and 
you find the xml file that contain your markups. Then you replace the markups 
by your data (you will have of course to duplicate some xml structures, if 
you have to replace for example one line of markups by several lines of 
data). Then you zip back the file, and you should get the result in 
OpenOffice.

Don't forget that xml is encoded in UTF-8.

Finally, it is "just" a matter of dealing with 'zip', 'unzip' and text file 
manipulation in Gambas. And you have to understand the xml OpenOffice format 
file, but just the part where you have to put your data. Otherwise, this 
format is documented, so you have to read the doc to understand what you can 
do.

Try it and tell me if it really works :-)

Regards,

-- 
Benoit Minisini





More information about the User mailing list