PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.2k forks source link

Codeigniter PHP Spreadsheet Integration #1307

Open tapas2u opened 6 years ago

tapas2u commented 6 years ago

After I integrated in CI 3.1.5 with PHP7.0. Now I am getting error when I tried to open the spreadsheet file "The file you are trying to open, '01simple-13.xls', is in a different format than specified by the file extension. Verify taht the file is not corrupted and is from a trusted source before opening the file. Do you want to open now?"

After opening the file I have seen special characters like

ÐÏࡱá;þÿ

àõÿ À

Please suggest what could be the reason.

Thanks Tapas

aishwaryacedcoss commented 6 years ago

I have also faced this issue . After a lot of search if found that CI overwrites the object created by php . So we have to clean the object before the final write using - ob_end_clean(); Please refer the link for more details -

http://tekina.info/generating-excel-using-phpspreadsheet-php/