I am trying to generate an Excel file using phpExcel library in Codeigniter. The problem is that while downloading the file it shows characters in in undifined formats
While opening the downloaded file it shows the message that is an different format, please refer the pic
and while opening the file content as
and my code stuff is:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$this->load->library('excel');
$sheet = new PHPExcel();
$objWorkSheet = $sheet->createSheet();
$sheet->getProperties()->setTitle('JDI Problem Improvement Strip')->setDescription('JDI Problem Improvement Strip');
$sheet->setActiveSheetIndex(0);
$sheet_writer = PHPExcel_IOFactory::createWriter($sheet, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');
$sheet_writer->save('php://output');