I am trying to export excel file using PHPExcel and Codeigniter as this.
I can't download the excel file but output is showing in console with an invalid character. This is the screen shot of console output.
I am trying to export excel file using PHPExcel and Codeigniter as this.
I can't download the excel file but output is showing in console with an invalid character. This is the screen shot of console output.
I had the same probleme. Use the class developped by Eliselab
https://github.com/EllisLab/CodeIgniter/wiki/Export-to-Excel-2013
For export you just need to put this on your controller.
$this->load->library('export');
$this->load->model('YourModel');
$result = $this->YourModel->YourQueryFunction();
$this->export->to_excel($result, 'nameForFile');
If you want to use PHPExcel try to put the same charset on all your pages, File charset & content charset. (UTF-8)
Put this on your file header :
header('Content-Type: text/html; charset=utf-8');
And change the type of file in UTF-8 Without Bom
On Nodepadd++ go to :
Click on "Format" Select "Encode in UTF-8 without BOM"
I hope it will help you.