Export to excel sheet in djanogo using pagination

104 views
Skip to first unread message

Nalini

unread,
Apr 23, 2009, 10:11:46 PM4/23/09
to Django users, nal...@hcl.in
Hi,

I have many pages to be exported to the excel sheet. I use django and
javascript.
i use pagination. Can any one help me out ?

Tim Chase

unread,
Apr 24, 2009, 6:18:51 AM4/24/09
to django...@googlegroups.com, nal...@hcl.in
> I have many pages to be exported to the excel sheet. I use django and
> javascript.
> i use pagination. Can any one help me out ?

Just create a custom view that returns apropos content/headers.
There are several ways of exporting files that Excel can read.

CSV files:
==========
+easy to make templates for or use the python "csv" module
+fairly universal access
+simple mime-type of text/csv
-can't control formatting
-no support for multiple tabs/pages
(we hacked this problem by zipping multiple .csv files)
-multiple "flavors" so you have to choose your escaping/quoting
rules; however there are some common conventions like "Excel"
that the CSV module facilitates

Native XLS files:
=================
+gives you "the real thing"
+simple mime-type
-requires an add-on module like xlwt or PyExcelerator

Office 2k3 "XML Spreadsheet" format:
====================================
+gives you much more control over formatting
+supports multiple tabs
+pretty easy to reverse-engineer for simple documents
-doesn't work with certain versions of Excel
-it's not really a standard
-not sure whether it works with OpenOffice.org/Gnumeric/KOffice
-raw format is very verbose, but a good candidate for compression
-getting Excel to open them requires a little mime-type hackery
in IE & FireFox

The new O2k7 abomination's format:
==================================
+you get the latest and greatest from MS
-it's not really a standard
-it's ugly
-it's a pain
-it's only supported 100% by O2k7
-it peeves people
(can you tell I've not seriously entertained implementing this
option because there are so many minuses to it)


From our experience, if you don't need formatting or need
universal access, use CSV. If you need formatting, we opted for
the "Office 2k3 XML Spreadsheet" for our purposes because it was
the fastest route to a solution for us.


There have been pretty lengthy discussions on the list which I've
been involved in, so here's a query that gets you some past
discussions:

http://groups.google.com/group/django-users/search?q=excel+csv+xml+tim+chase&group=django-users

Hope this helps,

-tim

Reply all
Reply to author
Forward
0 new messages