Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Has anyone generated Open Office Calc XML files from python

Reply
Thread Tools

Has anyone generated Open Office Calc XML files from python

 
 
vj
Guest
Posts: n/a
 
      11-16-2006
I have a program which generates xml files for excel but these files
are not recognized by open office calc. I looked at the OO uno library,
but it seems like an over kill.

In my experience, for simpler documents, it is much faster to directly
write to underlying XML format. Has anyone done this? Any idea on the
XML format used by Open Office Calc?

VJ

 
Reply With Quote
 
 
 
 
vj
Guest
Posts: n/a
 
      11-16-2006
I just found something in perl:

http://tools.openoffice.org/profilin...gFile/XML.html

Will try and reverse engineer this, unless something like this exists
in python.

VJ

 
Reply With Quote
 
 
 
 
vasudevram
Guest
Posts: n/a
 
      11-16-2006

vj wrote:
> I just found something in perl:
>
> http://tools.openoffice.org/profilin...gFile/XML.html
>
> Will try and reverse engineer this, unless something like this exists
> in python.
>
> VJ


Isn't generating CSV output suitable to your needs?
Python's CSV module makes that very simple - unless you want to include
images, etc. in the XLS file?

Vasudev
~~~~~~~~~~~~~~~~~~~~~~
Vasudev Ram
Dancing Bison Enterprises
Software consulting and training,
custom software development
http://www.dancingbison.com
http://sourceforge.net/projects/xtopdf
~~~~~~~~~~~~~~~~~~~~~~

 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      11-16-2006
vj wrote:

> I have a program which generates xml files for excel but these files
> are not recognized by open office calc. I looked at the OO uno library,
> but it seems like an over kill.


this could be a start:

http://ooopy.sourceforge.net/

</F>

 
Reply With Quote
 
vj
Guest
Posts: n/a
 
      11-16-2006

> http://ooopy.sourceforge.net/


I downloaded the package. unfortunately there are no examples that come
with. I found another python package which is more geared to creating
simple calc objects from python at. Apparently it is a port of the perl
library.

http://sourceforge.net/project/showf...group_id=87437

Here is one of the examples from the library. Seems pretty simple and
exactly what I was looking for:

-----------------------------------------------------------------------
import ooolib

# Create your document
doc = ooolib.Calc()

# Set values. The values are set in column, row order, but the values
are
# not in the traditional "A5" style format. Instead we require two
integers.
# set_cell_value(col, row, datatype, value)
for row in range(1, 9):
for col in range(1, 9):
doc.set_cell_value(col, row, "float", col * row)

# Save the document to the file you want to create
doc.save("calc-example01.ods")

-----------------------------------------------------------------------
VJ

 
Reply With Quote
 
vj
Guest
Posts: n/a
 
      11-16-2006
> Isn't generating CSV output suitable to your needs?
> Python's CSV module makes that very simple - unless you want to include
> images, etc. in the XLS file?


You cannot create multiple worksheets using this method, or apply any
other form of formatting.

VJ

 
Reply With Quote
 
vasudevram
Guest
Posts: n/a
 
      11-18-2006

vj wrote:
> > Isn't generating CSV output suitable to your needs?
> > Python's CSV module makes that very simple - unless you want to include
> > images, etc. in the XLS file?

>
> You cannot create multiple worksheets using this method, or apply any
> other form of formatting.
>
> VJ


Ok, got it.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ruby calc.rb or just calc.rb Kaye Ng Ruby 7 07-28-2010 05:21 AM
Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a worddocument in open office or any other applicatio Fredrik Lundh Python 1 01-09-2008 10:40 AM
Library to create MS Excel / OpenOffice calc files? Roman Hausner Ruby 4 05-21-2007 06:54 AM
Has anyone used Office 2007 (or earlier?) Open XML File Formats? John Kotuby ASP .Net 9 05-17-2007 09:34 PM
safe way to calc md5 on very large files rtilley Ruby 9 03-19-2006 07:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57