to try
public function rep() { //$this->load->library('phpexcel'); $this->load->library('PHPExcel/IOFactory'); $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy(" dev@Eri ") ->setTitle("Laporan Barang") ->setSubject("Laporan Barang") ->setDescription("report using PHPEXCEL.") ->setKeywords("office 2007 openxml php") ->setCategory("Test result file"); // Create the worksheet $objPHPExcel->setActiveSheetIndex(0); //DATA $data = array(array('kode'=>'B001', 'Barang'=>'Dunhill', 'Kategori'=>'Rokok'), array('kode'=>'B002', 'Barang'=>'Marlboro', 'Kategori'=>'Rokok'), array('kode'=>'B003', 'Barang'=>'Pepsodent', 'Kategori'=>'Pasta Gigi'), array('kode'=>'B004', 'Barang'=>'Gillete Goal', 'Kategori'=>'Pisau Cukur')); $objPHPExcel->getActiveSheet()->setCellValue('A6', "Kode Barang") ->setCellValue('B6', "Barang") ->setCellValue('C6', "Kategori");
source share