Closed yugendran closed 7 years ago
Well my guess is, the zipping causes this error. What happens if you do not zip the file?
what OS are you using?
The OS is Ubuntu 14.04 server. The zipping doesn't cause the corruption, this has been tested without zipping and the corruption still existed. Also I have updated the issue thread with complete environment.
Ok, please supply me with a Ruby Script (that creates a mentioned XLS file) with no Rails dependency whatsoever. Upload the script to gist.github.com and link it here.
spreadsheet (1.0.7)
I have been using the Spreadsheet gem to create xls files and zip them for download using rubyzip gem in my application.
Below is the code snippet of my lib class that generates xls files
And I zip the file like this in my controller
This approach works very well when I download the zip file with by Ubuntu desktop and read the xls file with LibreOffice. The zip is extracted properly without any issues and the xls sheet is read without any warnings for corruption.
But when I download the same zip file with Windows 7 and unzip with File explorer, the xls file when opened with MS Excel the "Error 0x80070057: The parameters are incorrect" error pops up with the below dialog
Excel found unreadable content in 'Attendance.xls'. Do you want to recover the contents of this workbook? If you trust the source of this Workbook, click Yes
Also when the xls files are uploaded as attachments to Gmail, it is being tagged as virus and is deleted.
This happens only for the xls files which are greater than 140kB in size created by Spreadsheet gem
I have attached the zip file that includes the xls
Environment:-
Production
Development
Gems version used:-
Production
Development
The mime type for above xls file created using Spreadsheet Gem is
application/CDFV2-corrupt; charset=binary