PHPExcel in CodeIgniter

Download thie file, and put it in your application/libraries/

Download PHPExcel and unzip.
Then, put it in your application/third_party/

And, user PHPExcel in your controller like below.

$this->load->library('excel');
$this->excel->setActiveSheetIndex(0);
$sheet = $this->excel->getActiveSheet();

        $style = array(
                'borders' => array(
                    'allborders' => array(
                        'style' => PHPExcel_Style_Border::BORDER_NONE
                    )
                )
            );
        $sheet->getDefaultStyle()->applyFromArray($style);
        unset($style);

        $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
        $objWriter->save($path.$filename.'.xls');

Popular Posts