Skip to content

Commit

Permalink
Bugfix: Excel export fail for long form titles.
Browse files Browse the repository at this point in the history
Workbook sheets created by xlwt must not contain more than 31 characters (I assume it's a limitation of Excel) - this should fix failing Excel exports for long form titles.
  • Loading branch information
barsch committed Sep 4, 2012
1 parent 18edf48 commit 25b656e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions forms_builder/forms/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from csv import writer
from mimetypes import guess_type
from os.path import join
Expand Down Expand Up @@ -130,7 +129,7 @@ def entries_view(self, request, form_id, show=False, export=False,
response["Content-Disposition"] = "attachment; filename=%s" % fname
queue = StringIO()
workbook = xlwt.Workbook(encoding='utf8')
sheet = workbook.add_sheet(form.title)
sheet = workbook.add_sheet(form.title[:31])
for c, col in enumerate(entries_form.columns()):
sheet.write(0, c, col)
for r, row in enumerate(entries_form.rows(csv=True)):
Expand Down

0 comments on commit 25b656e

Please sign in to comment.