473,624 Members | 2,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Python and Open Office

On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gs*********@gm ail.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 3326
Marco Bizzarri wrote:
On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gs*********@gm ail.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.cawro te:
Marco Bizzarri wrote:
On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gslindst...@gm ail.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*********@gm ail.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.et hz.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.et hz.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://opendocumentfel lowship.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://opendocumentfel lowship.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.RubyPrope rties
Requires the following attributes: No attribute is required.
Allows the following attributes: rubyalign, rubyposition.
These elements contain style.RubyPrope rties: style.DefaultSt yle,
style.Style.
The following elements occur in style.RubyPrope rties: 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://opendocumentfel lowship.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://opendocumentfel lowship.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
35522
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
23
3397
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 that I won't have surprises when my program runs on different real-world systems. So far I wrote a little script with python using urllib, and on one computer it failed completely because of a problem in getting the proxies (in my opinion this is a...
0
1378
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 as Java, Perl, Cygwin) are 'unsafe' and can't be installed." - Peter Olsen "There's nothing wrong with open source projects catering to a market, and there's nothing wrong with running open source software on a proprietary operating system." -...
3
2773
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 application exposes its VBA scripting interface through COM then it should be perfectly possible to entirely replace VBA in nearly
0
2296
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à : http://oootranslation.services.openoffice.org/pub/OpenOffice.org/2.0beta2rc/OOo_2.0beta2_Win32Intel_install_fr.zip Je cite ce lien, car j'ai réussi à piloter Open-Office, depuis Python, avec PyWin32. Vous trouverez ci dessous le script expérimental (code "brut" et méchant ; mais c'est la faisabilité qui importe ici).
1
1357
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 numerous files and folders. For example, a file saved from Open Office 2.0 named 'test.odt' can be unzipped into many parts... content.xml, meta.xml, settings.xml, etc, etc. How can I read these files do re searching and matching on them, etc?...
0
2739
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 Excel Application that I create, but when I open a Workbook in the Application I can't successfully Quit Excel (by this I mean I can quit it, but the Excel process isn't getting killed and I have to manually go this through Task Manager). I've...
8
4119
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 another Office program) and click File, Send To, Mail Recipient it opens a program I wrote in Python and uses it to send the email rather than Outlook. The closest I've come is finding the registry key HKLM\Software\Clients \Mail which seems to...
0
251
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 OpenOffice if possible, otherwise it starts OpenOffice and waits for it to accept a connection. def OpenSS(path):
0
8179
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8631
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8490
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1489
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.