Large numbers cause corrupt spreadsheets
Created originally on Bitbucket by iphitus
Hi,
The sample code below results in a corrupt spreadsheet (Excel 2010, openpyxl 2e299af78e15).
Opening the xml file I see: {{{ 9781231231230L }}}
I suspect this is due to repr on line 169-170 in worksheet.py {{{ elif cell.data_type == cell.TYPE_NUMERIC: tag(doc, 'v', body = repr(value)) }}} {{{
repr(1234567890) '1234567890' repr(12345678901) '12345678901L' str(12345678901) '12345678901' }}} I changed repr->str and Excel now opens my files without complaint
Sample code:
{{{ #!python import openpyxl import openpyxl.workbook wb=openpyxl.workbook.Workbook()
ws=wb.get_active_sheet() ws.append(['9781231231230']) wb.save('fail.xlsx') }}}