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

This commit is contained in:
chfw 2015-11-01 17:38:33 +00:00
parent 09a698b863
commit 18876f9d37
2 changed files with 11 additions and 3 deletions

View File

@ -201,7 +201,7 @@ class XLWriter(BookWriter):
def __init__(self, file, **keywords):
"""Initialize a xlwt work book"""
BookWriter.__init__(self, file, **keywords)
self.wb = Workbook()
self.wb = Workbook(style_compression=2)
def create_sheet(self, name):
"""Create a xlwt writer"""

View File

@ -6,7 +6,8 @@
import os
import pyexcel as pe
import pyexcel.ext.xls
import pyexcel.ext.xls as xls
from pyexcel_io import OrderedDict
import datetime
@ -20,4 +21,11 @@ class TestBugFix:
"test-fixtures",
"test-date-format.xls"))
assert s[0,0] == datetime.datetime(2015, 11, 11, 11, 12, 0)
def test_pyexcel_xls_issue_2(self):
data = OrderedDict()
array = []
for i in xrange(4100):
array.append([datetime.datetime.now()])
data.update({"test": array})
s = xls.save_data("test.xls", data)