Re: Read / Write OpenOffice SpreadSheet ?

2010-12-17 Thread Torsten Mohr
Hello,

 There is no package needed to read or write the new open document files.
 The files are merely a jar archive containing XML files.  You can open
 and update them using jar as a subprocess and manipulate the XML files
 using your favorite XML libraries DOM/SAX/XPath/Etree/etc.

thanks for your hint.  I was aware of that, OO files are a bunch of zipped 
XML files.  But, i searh for something more comfortable/highlevel that lets 
me just do things like doc.Cell(1, 3) = 'abc' or so.

 If that doesn't suit you, you can manipulate them using OO.org through its
 UNO interface; but, I find that much more involved then simply accessing
 the files directly.

Thanks, i read about it but as i understood it, UNO needs Python 2.3.x and 
i'd like to base on something actual.


Best regards,
Torsten.

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


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-17 Thread Stefan Behnel

Torsten Mohr, 17.12.2010 02:07:

i search for a possibility to access OpenOffoce SpreadSheets from Python
with a reasonably new version of Python.

Can anybody point me to a package that can do this?


Have you looked through the relevant PyPI packages?

http://pypi.python.org/pypi?%3Aaction=searchterm=openoffice

Stefan

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


PyUNO [Was: Read / Write OpenOffice SpreadSheet ?]

2010-12-17 Thread Adam Tauno Williams
On Fri, 2010-12-17 at 10:19 +0100, Torsten Mohr wrote:
 Thanks, i read about it but as i understood it, UNO needs Python 2.3.x and 
 i'd like to base on something actual.

I do not *believe* this is true.

http://pypi.python.org/pypi/cloudooo/1.0.9 for instance is Python 2.6
and uses PyUNO.

I would strongly recommend against floundering about in OOo's very
complex XML files - it is trivially easy to render a document unusable.

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


Re: PyUNO [Was: Read / Write OpenOffice SpreadSheet ?]

2010-12-17 Thread Stefan Behnel

Adam Tauno Williams, 17.12.2010 17:02:

On Fri, 2010-12-17 at 10:19 +0100, Torsten Mohr wrote:

Thanks, i read about it but as i understood it, UNO needs Python 2.3.x and
i'd like to base on something actual.


I do not *believe* this is true.

http://pypi.python.org/pypi/cloudooo/1.0.9  for instance is Python 2.6
and uses PyUNO.


The Python installation can be replaced. Last I heard, many Linux distros 
used the platform Python, for example, instead of shipping an embedded one 
with OOo.




I would strongly recommend against floundering about in OOo's very
complex XML files - it is trivially easy to render a document unusable.


True. It's not so much of a problem to read them, but writing a correct 
document can be tricky. What works relatively well is to write a template 
document in OOo and do programmatic replacements in it. But that's not 
guaranteed to work, either.


Stefan

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


Re: PyUNO [Was: Read / Write OpenOffice SpreadSheet ?]

2010-12-17 Thread Tim Harig
On 2010-12-17, Adam Tauno Williams awill...@whitemice.org wrote:
 I would strongly recommend against floundering about in OOo's very
 complex XML files - it is trivially easy to render a document unusable.

I do it all the time and have never had a problem.  I don't generate the
documents from scratch; I generate a template that contains everything
that don't need to dynamically generate.  Then I use one of two methods
to to update the content.xml:

1. In the simplest cases, I only need to change a single data field.  I
replace the literal data in the content.xml file with:

replace field=variable_name/

Then, using a DOM implementation, I can use getElementsByTagName()
to get all of the replace tags and send the variable name to a
distpach that generates the text used to replace the tag.

2. For collections of data (spreadsheet cells, table cells/rows, etc,
I leave one piece of sample data in place.  I then clone the DOM
element that I can use as a template and delete the origional.
Entering the data is then a simple matter of cloning the template
element, updating the information that it contains, and adding
it to the childNodes of the parent.  Since tags all come from
the file that OO.org/LibreOffice generated, the resulting markup
will be valid.

Once the content.xml file has been updated, I simply run jar as a
subprocess to update the content.xml file in the ods/odt file.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyUNO [Was: Read / Write OpenOffice SpreadSheet ?]

2010-12-17 Thread Stef Mientki
On 17-12-2010 17:02, Adam Tauno Williams wrote:
 On Fri, 2010-12-17 at 10:19 +0100, Torsten Mohr wrote:
 Thanks, i read about it but as i understood it, UNO needs Python 2.3.x and 
 i'd like to base on something actual.
 I do not *believe* this is true.

 http://pypi.python.org/pypi/cloudooo/1.0.9 for instance is Python 2.6
 and uses PyUNO.

 I would strongly recommend against floundering about in OOo's very
 complex XML files - it is trivially easy to render a document unusable.

looks great,
but is there something alike for Windows ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-17 Thread Terry Reedy

On 12/17/2010 4:19 AM, Torsten Mohr wrote:

Hello,


There is no package needed to read or write the new open document files.
The files are merely a jar archive containing XML files.  You can open
and update them using jar as a subprocess and manipulate the XML files
using your favorite XML libraries DOM/SAX/XPath/Etree/etc.


thanks for your hint.  I was aware of that, OO files are a bunch of zipped
XML files.  But, i searh for something more comfortable/highlevel that lets
me just do things like doc.Cell(1, 3) = 'abc' or so.


http://opendocumentfellowship.com/projects/odfpy

--
Terry Jan Reedy

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


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-17 Thread Hans-Peter Jansen
On Friday 17 December 2010, 02:07:07 Torsten Mohr wrote:
 Hi,

 i search for a possibility to access OpenOffoce SpreadSheets from
 Python with a reasonably new version of Python.

 Can anybody point me to a package that can do this?

http://ooopy.sourceforge.net/

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


Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread Torsten Mohr
Hi,

i search for a possibility to access OpenOffoce SpreadSheets from Python 
with a reasonably new version of Python.

Can anybody point me to a package that can do this?


Best regards,
Torsten.

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


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread Emile van Sebille

On 12/16/2010 5:07 PM Torsten Mohr said...

Hi,

i search for a possibility to access OpenOffoce SpreadSheets from Python
with a reasonably new version of Python.

Can anybody point me to a package that can do this?




If you're open to 'saving as xls' then xlrd/xlwt works well.

Otherwise, when I last checked in on this about 18 months ago, it 
appeared that python support in OO never quite got the traction I hoped 
it might...


Emile


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


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread Tim Harig
On 2010-12-17, Torsten Mohr tm...@s.netic.de wrote:
 i search for a possibility to access OpenOffoce SpreadSheets from Python 
 with a reasonably new version of Python.

 Can anybody point me to a package that can do this?

There is no package needed to read or write the new open document files.
The files are merely a jar archive containing XML files.  You can open
and update them using jar as a subprocess and manipulate the XML files
using your favorite XML libraries DOM/SAX/XPath/Etree/etc.

If that doesn't suit you, you can manipulate them using OO.org through its
UNO interface; but, I find that much more involved then simply accessing
the files directly.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread Tim Chase

On 12/16/2010 07:53 PM, Tim Harig wrote:

On 2010-12-17, Torsten Mohrtm...@s.netic.de  wrote:

i search for a possibility to access OpenOffoce SpreadSheets from Python
with a reasonably new version of Python.

Can anybody point me to a package that can do this?


There is no package needed to read or write the new open document files.
The files are merely a jar archive containing XML files.  You can open
and update them using jar as a subprocess and manipulate the XML files
using your favorite XML libraries DOM/SAX/XPath/Etree/etc.


To make that even easier (no need for a subprocess launching a 
JAR tool), JAR files are just ZIP files (IIRC, they may have some 
particularly-named files for metadata purposes, but it's all just 
a big zip-blob), so you can use Python's native zipfile module to 
crack into it.  Then, as TimH suggests, wander around in the XML 
(and other files) inside.


-tkc



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


Re: Read / Write OpenOffice SpreadSheet ?

2010-12-16 Thread joymanchen



Torsten Mohr  写入消息 news:ieed6o$iq...@news.lf.net...

Hi,

i search for a possibility to access OpenOffoce SpreadSheets from Python
with a reasonably new version of Python.

Can anybody point me to a package that can do this?


Best regards,
Torsten. 



--- news://freenews.netfront.net/ - complaints: n...@netfront.net ---
--
http://mail.python.org/mailman/listinfo/python-list