473,385 Members | 1,325 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.

Has anyone generated Open Office Calc XML files from python

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

Nov 16 '06 #1
6 2669
vj
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

Nov 16 '06 #2

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
~~~~~~~~~~~~~~~~~~~~~~

Nov 16 '06 #3
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>

Nov 16 '06 #4
vj
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

Nov 16 '06 #5
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

Nov 16 '06 #6

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.

Nov 18 '06 #7

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...
0
by: Jim Kerr | last post by:
I am trying to reconstruct Python source files from an application I generated from py2exe. I accidentally deleted the sources for the app, but the py2exe-generated executable contains .pyc files...
6
by: Skip Montanaro | last post by:
I wrote PEP 304, "Controlling Generation of Bytecode Files": http://www.python.org/peps/pep-0304.html quite awhile ago. The first version appeared in January 2003 in response to questions...
9
by: Tom Weston | last post by:
Help I have 4 databases containing different data relating to safety, not written by me. It is not possible to merge the databases into one large data base. I would like to create a user interface...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
21
by: mm | last post by:
(Yes, I konw whats an object is...) BTW. I did a translation of a pi callculation programm in C to Python. (Do it by your own... ;-) -------- Calc PI for 800 digs(?). (german: Stellen) ------...
9
by: John Kotuby | last post by:
Hi all... While looking around for tools to create Excel files from either HTML pages or the Data I use to assemble them, I got an interesting response from a vendor. I have looked at Apose, and...
0
by: amit dutta | last post by:
while executing the following code i am getting error message as "methods and variable not defined and also " com.sun.star.uno.runtime exception" Change the code for me as per request....
9
by: Marco Bizzarri | last post by:
On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <gslindstrom@gmail.comwrote: Ciao, Greg. you should check with the openoffice.org mailing list; I think what you are looking for is the api...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.