Only wrap when needed.

This commit is contained in:
Kenneth Reitz
2010-10-04 15:50:41 -04:00
parent 4d1c5a9996
commit 817eedd6f5
+7 -1
View File
@@ -9,9 +9,12 @@ import cStringIO
title = 'xls'
extentions = ('xls',)
# special styles
wrap = xlwt.easyxf("alignment: wrap on")
bold = xlwt.easyxf("font: bold on")
def export_set(dataset):
"""Returns XLS representation of Dataset."""
@@ -62,6 +65,9 @@ def dset_sheet(dataset, ws):
# wrap the rest
else:
ws.write(i, j, col, wrap)
if '\n' in col:
ws.write(i, j, col, wrap)
else:
ws.write(i, j, col)