Al Boldi wrote:
Tiziano_mk wrote:
I wish to add this missing item that i find more interesting:

"Maybe you want to use python to control OpenOffice with Free pascal?"
It's possible, just embed FPC with the python "embedded" in OpenOffice.

During holydays I made successfully this test (on windows) and I am
still investigating on the details.

Sorry but by now I don't have documentation, work is in progress, if
someone is interested (and this thread shows how few people is
interested in this matter) I can give further details.

Can you give further details?



ok, I try to give a brief overview, here I talk of FPC but read that as FPC/Lazarus, please:

look at the Python Documentation: Extending and Embedding (http://docs.python.org/ext/ext.html)

This chapter explains the ways to use python with other applications, it is C/C++ based but it is simple to translate all that in Pascal.

Here you can see the concepts of Extending python with C/C++/FPC and Embedding python in C/C++/FPC.

With this in mind you have not to port Python for Delphi to Lazarus, you can simply build a suite of (simple) units that make up the interface with the pythonxx.dll or pythonxx.so libraries, and this is possible respecting the multiplatform requirements of FPC.

Now, since you can easily launch python scripts or modules from an application compiled with FPC it is also possible to bind this application with the pythonxx.dll that OpenOffice installs with its binaries. This is an ordinary python distribution integrated with modules that interface python with the OO APIs.

Now you need to look at PyUno documentation (http://udk.openoffice.org/python/python-bridge.html). Here you can see how to use Python and the Python-UNO bridge to issue commands to OpenOffice.

With FPC you can only excecute the python Uno Bridge outside of the OpenOffice process, this is a bit slow, but it is enough to launch from FPC a simple helloworld.py that opens an OOWriter document and writes in the document the usual "HelloWorld!" string (I tested this on Windows, and I have to test if it really works also on Linux).

(note: Issuing commands to OpenOffice can be easily done with Delphi, this is explained in the OpenOffice SDK, but it uses the Uno OLE automation bridge. Since OLE and COM is not available in other platforms, FPC doesn't support them, so, this approach is not available for it)

From here there is a lot of work and experimentation to do, since it is not enough to call python scripts to issue commands, but it is essential to exchange data from FPC<->Python<->Office.

that's all by now, this is the idea. I'd like to hear some feedback about that...


bye
tiziano







_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to