Hi ;).

Let's start with some presentation, please jump ahead for the 
interesting stuff.

We (I mean my company) have evaluating some options to make a kind of 
"business intelligence" web application. Basically a simple web page 
where users make some selections, the app query a database and returns a 
spreadsheet with some (well, some thousands of lines) data to further 
process.

I had make some test with Zope and the zopedb product. Even make some 
small test app. But I don't like it a lot, except by the way it 
generates openoffice documents with the ZPT (Zope template system).

Some weeks ago we try Django. I made our test app (it's probably going 
into production next week, yes it was a very nice test app. No I'm not 
sure about it, it has been done with the svn version of django and I'm 
not too confident to put it on production, even if this app is only 
going to be used by 4 or 5 users).

HERE GOES THE INTERESTING STUFF

We search google for some info on opendocument support in django and we 
find nothing. Creating spreadsheets was our goal so we develop something 
similar in the test app. We add a module to create odt documents, odt 
stands for "open document text". They are the .doc of openoffice.

We decided to share it here to get some feedback. We are planing to 
restructure it to make it able to produce spreadsheets. It could 
probably be easy to expand to work with the other open document formats, 
or even with the Office XML files.

It's just a small script that relies on the power of the django template 
system.

Usage:

1) Installation : Just drop the openoffice.py module in your app dir.

2) Create the document: Create an odt document, as complex as you like.

If you use openoffice to do it, please go to the configuration and 
uncheck "Optimize XML for size". This will make the XML of the saved 
file much more human readable.

Save it to a file like test.odt

3) Somewhere in you template path make some dir to store the document. 
Let's say it will be called test

4) Unzip test.odt inside test.

5) Locate and edit context.xml file. Treat it as a any django template.

6) In your views add:

from yourapp.openoffice import *

def odt(request):
        return odtgen('temp',{context},'filename.odt')

The odtgen function expects the name of the dir where the original file 
is unpacked, a context used to render context.xml and a default filename 
for the attachment.

The scripts imports the zip library, so it must be installed. I believe 
it's installed by default with python, but I'm not completely sure.

It should be considered pre-alfa software. I haven't even tried it in a 
production server yet.

The download link:

http://www.box.net/public/m8q3p8thnj

And that's all.

Javier (a long post in bad english, if you really read until here thank 
you ;).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to