Closed iox closed 9 years ago
This is interesting. Please post your sample script to gist.github.com and link it here. Please also link your sample XLS here. What OS do you use? What Ruby Version do you use? What spreadsheet gem Version do you use?
The code: https://gist.github.com/iox/6278d60911212d31d08d
And the file: https://www.dropbox.com/s/0exn27xtritkluo/spreadsheet_currency_test.xls?dl=0
I'm using Ubuntu 12.04, Ruby 2.1.3p242 and spreadsheet 1.0.0.
This works perfectly fine with LibreOffice. Have you tried it with LibreOffice?
Yes, it works with LibreOffice. The problem is with Office Excel. I have tested version 2013 but probably other versions have this issue too. Excel expects the stylesheet to have the 6 default styles defined inside every XLS file and it fails if they are not there.
I think this is a bad design from Excel side, but I was wondering if spreadsheet could try to write those default styles into the generated XLS files. What do you think?
I think it is "only" a problem with Excel 2013. Have you tested with other versions? Excel 2013 is not very consistent with the other Excel Versions.
When opening a XLS file generated with the spreadsheet gem with Excel 2013 and clicking on the "currency" icon in the toolbar, an error appears saying:
Style 'Currency' not found
This problems seems to be related to some builtin styles added to all XLS files created by Excel. This is something not unique to this gem, see https://github.com/python-excel/xlwt/issues/9
I have looked through the source and them gem knows of the existence of the "Currency" style (https://github.com/zdavatz/spreadsheet/search?utf8=%E2%9C%93&q=BUILTIN_STYLES). But it doesn't seem to be writing this information into the XLS file on saving.
Thanks!