471,073 Members | 1,166 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Re: Python and Open Office

On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gs*********@gmail.comwrote:
Hello,

I would like to create and manipulate Open Office documents using Python. I
have found then UNO Python page and odfpy modules which seem to be exactly
what I need. The odfpy manual is, to me, a confusing list of objects and
methods (it's an impressive list!), but does not have much in the way of how
to use them. For example, I can open a spreadsheet and create new pages
(there's a nice example near the back of the manual) but I can't figure out
how to open an existing spreadsheet and list the names of the individual
sheets ("tabs").

I have written an application that access Microsoft Excel and creates
reports for work, but would like to create an Open Source version using Open
Office and release it to the community (and maybe get a talk at PyCon :-).

Is there someone here who can help me out, or is there an appropriate
mailing list for me to join?
Ciao, Greg.

you should check with the openoffice.org mailing list; I think what
you are looking for is the api mailing list for openoffice; you could
try to get the OpenOffice.org developers guide and the SDK, and check
it (but it is not a little work)

Regards
Marco

Thanks

--greg

--
http://mail.python.org/mailman/listinfo/python-list


--
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
Sep 10 '08 #1
9 3097
Marco Bizzarri wrote:
On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gs*********@gmail.comwrote:
>Hello,

I would like to create and manipulate Open Office documents using Python. I
have found then UNO Python page and odfpy modules which seem to be exactly
what I need. The odfpy manual is, to me, a confusing list of objects and
methods (it's an impressive list!), but does not have much in the way of how
to use them. For example, I can open a spreadsheet and create new pages
(there's a nice example near the back of the manual) but I can't figure out
how to open an existing spreadsheet and list the names of the individual
sheets ("tabs").

I have written an application that access Microsoft Excel and creates
reports for work, but would like to create an Open Source version using Open
Office and release it to the community (and maybe get a talk at PyCon :-).

Is there someone here who can help me out, or is there an appropriate
mailing list for me to join?

Ciao, Greg.

you should check with the openoffice.org mailing list; I think what
you are looking for is the api mailing list for openoffice; you could
try to get the OpenOffice.org developers guide and the SDK, and check
it (but it is not a little work)

Regards
Marco

>Thanks

--greg

--
http://mail.python.org/mailman/listinfo/python-list


Greg,

If you follow this up, I hope that you
will post info to c.l.p
and let us know whether the UNO
interface is Python 2.5 compatible.

The last time I looked it was set for
2.3 or 2.4.

Colin W
Sep 10 '08 #2
On Sep 11, 7:04*am, "Colin J. Williams" <c...@ncf.cawrote:
Marco Bizzarri wrote:
On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gslindst...@gmail.comwrote:
Hello,
I would like to create and manipulate Open Office documents using Python. *I
have found then UNO Python page and odfpy modules which seem to be exactly
what I need. *The odfpy manual is, to me, a confusing list of objects and
methods (it's an impressive list!), but does not have much in the way of how
to use them. *For example, I can open a spreadsheet and create new pages
(there's a nice example near the back of the manual) but I can't figure out
how to open an existing spreadsheet and list the names of the individual
sheets ("tabs").
I have written an application that access Microsoft Excel and creates
reports for work, but would like to create an Open Source version using Open
Office and release it to the community (and maybe get a talk at PyCon :-).
Is there someone here who can help me out, or is there an appropriate
mailing list for me to join?
Ciao, Greg.
you should check with the openoffice.org mailing list; I think what
you are looking for is the api mailing list for openoffice; you could
try to get the OpenOffice.org developers guide and the SDK, and check
it (but it is not a little work)
Regards
Marco
Thanks
--greg
--
http://mail.python.org/mailman/listinfo/python-list

Greg,

If you follow this up, I hope that you
will post info to c.l.p
and let us know whether the UNO
interface is Python 2.5 compatible.

The last time I looked it was set for
2.3 or 2.4.

Colin W

I've recently been working on interfacing with OpenOffice via UNO with
Python.

I can confirm that unfortunately, the PyUNO interface presently
(OpenOffice 2.4) is built with Python 2.3... so to use the UNO
interface from Python you have to write a separate script to run in
the OpenOffice Python 2.3 environment.

Apparently someone is working on rebuilding the PyUNO library for
Python 2.5 but there's no timeframe for when that might be included
with the OpenOffice distribution.

You could try building PyUNO with Python 2.5 yourself, I'm sure I came
across instructions somewhere on the OpenOffice developer website...

I've not used odfpy so don't know how it compares in terms of degree
of difficulty to UNO.
Sep 11 '08 #3
Marco Bizzarri schrieb:
On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gs*********@gmail.comwrote:
>Hello,

I would like to create and manipulate Open Office documents using Python. I
[...]
>Is there someone here who can help me out, or is there an appropriate
mailing list for me to join?

Ciao, Greg.

you should check with the openoffice.org mailing list; I think what
you are looking for is the api mailing list for openoffice; you could
try to get the OpenOffice.org developers guide and the SDK, and check
it (but it is not a little work)
If want to create documents, there is no nead to fight with OOo and UNO.
As I thought everybody already knows, ODF is simply a Zip-File
containing some XML files. So there is no need to use OOo for handling
the files.

So odfpy seams to be the best way to to this. You may also want to check
OOopy <http://pypi.python.org/pypi/OOoPy/>.

If you are going to interact with OOo, you may want to try out
<http://openoffice-python.origo.ethz.ch/>

--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de
Sep 16 '08 #4
Peter Georgeson schrieb:
I can confirm that unfortunately, the PyUNO interface presently
(OpenOffice 2.4) is built with Python 2.3... so to use the UNO
interface from Python you have to write a separate script to run in
the OpenOffice Python 2.3 environment.
This may be true for Windows. On Linux - at least for Mandriva --, OOo
is already integrated with Python 2.5.

--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de
Sep 16 '08 #5
Hartmut Goebel wrote:
As I thought everybody already knows, ODF is simply a Zip-File
containing some XML files.
I thought it just *was* xml. But examination with notepad showed
otherwise.
So there is no need to use OOo for handling
the files.

So odfpy seams to be the best way to to this.
Since odfpy automatically handles combining the at-least-4 xml files
into one coherent class on loading, and putting the various properties
into the proper xml files on saving, this looks pretty straightforward.
Thanks for the reference.

One way to learn the meaning of some of the numerous attributes and
values is to create a file with the wanted features with OOo, save,
unzip, and examine the xml to see which tags are used for which features.
You may also want to check
OOopy <http://pypi.python.org/pypi/OOoPy/>.
I will glance at that too.
>
If you are going to interact with OOo, you may want to try out
<http://openoffice-python.origo.ethz.ch/>
Sep 16 '08 #6
Terry Reedy schrieb:
One way to learn the meaning of some of the numerous attributes and
values is to create a file with the wanted features with OOo, save,
unzip, and examine the xml to see which tags are used for which features.
The API docs are a bit hidden on the webpage. Here is the link:
<http://opendocumentfellowship.com/files/api-for-odfpy_2.odt>

Additionally teh ODF sepcs may help:
<http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.pdf>

Regards
H. Goebel
Sep 17 '08 #7
Hartmut Goebel wrote:
Terry Reedy schrieb:
>One way to learn the meaning of some of the numerous attributes and
values is to create a file with the wanted features with OOo, save,
unzip, and examine the xml to see which tags are used for which features.

The API docs are a bit hidden on the webpage. Here is the link:
<http://opendocumentfellowship.com/files/api-for-odfpy_2.odt>
I wrote my comment *after* looking at the above, which I found easily
enough. After 7 pages of (helpful) explanatory text, there follow 88
pages with hundreds of entries like this:

5.13.30 style.RubyProperties
Requires the following attributes: No attribute is required.
Allows the following attributes: rubyalign, rubyposition.
These elements contain style.RubyProperties: style.DefaultStyle,
style.Style.
The following elements occur in style.RubyProperties: No element is allowed.

which are translated to a more readable form from the Relax-NG schema
(formal specs) in the standard. But I have no idea what a Ruby property
is in this context. It would be much like reading the grammar entries
in the Python Reference without the explanatory text that follows.
Additionally teh ODF sepcs may help:
<http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.pdf>
v1.0 is the adopted international (ISO/IEC) standard.
I did not notice whether odfpy supports the 1.1 extensitons, but since
it does appear that OOo now uses them, I will presume so.

This does help. It has more explanatory material.
"5.4 Ruby
A ruby is additional text that is displayed above or below some base
text. The purpose of ruby is to annotate the base text or provide
information about its pronunciation.

tjr

Sep 17 '08 #8
On Wednesday 17 September 2008 21:59, Terry Reedy wrote:
Hartmut Goebel wrote:
>Terry Reedy schrieb:

The API docs are a bit hidden on the webpage. Here is the link:
<http://opendocumentfellowship.com/files/api-for-odfpy_2.odt>

I wrote my comment *after* looking at the above, which I found easily
enough. After 7 pages of (helpful) explanatory text, there follow 88
pages with hundreds of entries like this:
[...]
which are translated to a more readable form from the Relax-NG schema
(formal specs) in the standard. But I have no idea what a Ruby property
is in this context. It would be much like reading the grammar entries
in the Python Reference without the explanatory text that follows.
I started using odfpy for a project, and I found that I spent a lot of time
flicking back and forth in the API manual and cross-referencing it with the
specification. The simple examples were useful enough to get started with,
but I could have used more information about how to use certain classes
and what elements and attributes they required.

I also wanted to add equations to the documents I was producing and that
requires some knowledge of MathML.

Certainly, it's not a very high level API for documentation creation - you
need to know something about the format to be able to construct documents.

David
Sep 18 '08 #9
Terry Reedy schrieb:
Hartmut Goebel wrote:
>The API docs are a bit hidden on the webpage. Here is the link:
<http://opendocumentfellowship.com/files/api-for-odfpy_2.odt>

I wrote my comment *after* looking at the above, which I found easily
enough. After 7 pages of (helpful) explanatory text, there follow 88
pages with hundreds of entries like this:
[...]

Well, I wrote my comment *before* looking at the API docs. Your are
absolutely right: It is not helpful.
>Additionally teh ODF sepcs may help:
<http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.pdf>

v1.0 is the adopted international (ISO/IEC) standard.
Specs for ODF 1.0 are available the oasis-open.org, too. So if you want
to keep close the the ISO standard you surely are better off using 1.0.
Alternativly you may use the 1.1 docs and skim the appendix about changes.

Regards
H. Goebel
Sep 19 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Allison Bailey | last post: by
23 posts views Thread by assaf__ | last post: by
3 posts views Thread by Wolfgang Keller | last post: by
reply views Thread by Do Re Mi chel La Si Do | last post: by
1 post views Thread by tubby | last post: by
reply views Thread by liam_jones | last post: by
8 posts views Thread by kyosohma | last post: by
reply views Thread by Gary Herron | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.