Skip to content

Commit 18876f9

Browse files
committed
fix #2: ValueError: More than 4094 XFs (styles) # when writing to xls : reference: http://stackoverflow.com/questions/17130516/xlwt-set-style-making-error-more-than-4094-xfs-styles
1 parent 09a698b commit 18876f9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pyexcel_xls/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class XLWriter(BookWriter):
201201
def __init__(self, file, **keywords):
202202
"""Initialize a xlwt work book"""
203203
BookWriter.__init__(self, file, **keywords)
204-
self.wb = Workbook()
204+
self.wb = Workbook(style_compression=2)
205205

206206
def create_sheet(self, name):
207207
"""Create a xlwt writer"""

tests/test_bug_fixes.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
import os
88
import pyexcel as pe
9-
import pyexcel.ext.xls
9+
import pyexcel.ext.xls as xls
10+
from pyexcel_io import OrderedDict
1011
import datetime
1112

1213

@@ -20,4 +21,11 @@ def test_pyexcel_issue_5(self):
2021
"test-fixtures",
2122
"test-date-format.xls"))
2223
assert s[0,0] == datetime.datetime(2015, 11, 11, 11, 12, 0)
23-
24+
25+
def test_pyexcel_xls_issue_2(self):
26+
data = OrderedDict()
27+
array = []
28+
for i in xrange(4100):
29+
array.append([datetime.datetime.now()])
30+
data.update({"test": array})
31+
s = xls.save_data("test.xls", data)

0 commit comments

Comments
 (0)