473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 3293
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
23
by: assaf__ | last post by:
Hello, I am beginning to work on a fairly large project and I'm considering to use python for most of the coding, but I need to make sure first that it is reliable enough. I need to make sure...
0
by: Simon Brunning | last post by:
QOTW: "The security 'droids have decided that since the MS Office Suite is a 'standard' application then software written in MS Office VBA must be 'safe.' Any other development environments (such...
3
by: Wolfgang Keller | last post by:
Hello, this is a potentially veeery dumb question, but: - If an application supports VBA as a macro language, - and if you can execute Python code from within a VBA script (how?) - and if the...
0
by: Do Re Mi chel La Si Do | last post by:
Open-Office 2.0 bêta-2 français pour Windows (en fait, la 1.9.125 ) est sortie. Vous la trouverez là : ...
1
by: tubby | last post by:
How are Python users dealing with some of the new OASIS Open Document formats (Open Office) or MS Open XML formats. These formats store data in a file which is actual a zip archive that contains...
0
by: liam_jones | last post by:
I'm very new to Python, well IronPython to precise, and have been having problems when using Excel. The problem I'm having is the closing of my Excel object. I'm able to successfully quit the...
8
by: kyosohma | last post by:
Hi, I've been googling all over and can't find any good answers about this problem. I would like to create some kind of MAPI interface with Python such that when I open Microsoft Word (or...
0
by: Gary Herron | last post by:
Greg Lindstrom wrote: Here's a snippet of code I use to open a spreadsheet (given as a file path name), and compute and return the list of sheets it contains. It connects to an existing...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.