Has anyone generated Open Office Calc XML files from python

V

vj

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
 
V

vasudevram

vj said:
I just found something in perl:

http://tools.openoffice.org/profiling/pod/LogFile/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
~~~~~~~~~~~~~~~~~~~~~~
 
V

vj


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/showfiles.php?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")
 
V

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?

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

VJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top