backoffice: limit xls cell content to 32767 characters (#7056)

Total number of characters that a cell can contain: 32,767 characters

source: https://support.office.com/en-nz/article/Excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa
This commit is contained in:
Frédéric Péters 2015-04-27 19:20:12 +02:00
parent af4b73b3ad
commit 9b4e963c82
1 changed files with 4 additions and 0 deletions

View File

@ -988,6 +988,10 @@ class FormPage(Directory):
for i, filled in enumerate(items):
for j, elem in enumerate(self.formpage.csv_tuple(fields, filled)):
if elem and len(elem) > 32767:
# xls cells have a limit of 32767 characters, cut
# it down.
elem = elem[:32760] + ' [...]'
ws.write(i+1, j, elem)
self.output = cStringIO.StringIO()