From 817eedd6f5cdc8dab03b024947bf0b2663ccc820 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 4 Oct 2010 15:50:41 -0400 Subject: [PATCH] Only wrap when needed. --- tablib/formats/_xls.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tablib/formats/_xls.py b/tablib/formats/_xls.py index 76e9318..0e989a7 100644 --- a/tablib/formats/_xls.py +++ b/tablib/formats/_xls.py @@ -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) \ No newline at end of file