Note that there are some explanatory texts on larger screens.

plurals
  1. POPHPExcel error in CodeIgniter "Unable to load the requested class: iofactory"
    text
    copied!<p>I'm trying to export an XLS file with PHPExcel 1.7.8 + CodeIgniter 2.1.3</p> <p>I have followed all the instructions from <a href="https://github.com/EllisLab/CodeIgniter/wiki/PHPExcel" rel="nofollow">PHPExcel</a> </p> <p>but I'm getting this error:</p> <blockquote> <blockquote> <p>Unable to load the requested class: <code>iofactory</code></p> </blockquote> </blockquote> <p>and here's my Controller code:</p> <pre><code> //expoxt to excel all admin data function export_excel_admin() { //$data['resultsadmin'] = $this-&gt;admin_model-&gt;get_all_data_admin(); //var_dump($data['resultsadmin']); //$this-&gt;load-&gt;view('administrator/export_excel/export_excel_admin', $data); $query = $this-&gt;db-&gt;get('tbl_admin'); if(!$query) return false; // Starting the PHPExcel library $this-&gt;load-&gt;library('excel'); $this-&gt;load-&gt;library('PHPexcel/IOFactory'); $objPHPExcel = new PHPExcel(); $objPHPExcel-&gt;getProperties()-&gt;setTitle("export")-&gt;setDescription("none"); $objPHPExcel-&gt;setActiveSheetIndex(0); // Field names in the first row $fields = $query-&gt;list_fields(); $col = 0; foreach ($fields as $field) { $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValueByColumnAndRow($col, 1, $field); $col++; } // Fetching the table data $row = 2; foreach($query-&gt;result() as $data) { $col = 0; foreach ($fields as $field) { $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValueByColumnAndRow($col, $row, $data-&gt;$field); $col++; } $row++; } $objPHPExcel-&gt;setActiveSheetIndex(0); $objWriter = IOFactory::createWriter($objPHPExcel, 'Excel5'); // Sending headers to force the user to download the file header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="Products_'.date('dMy').'.xls"'); header('Cache-Control: max-age=0'); $objWriter-&gt;save('php://output'); } </code></pre> <p>Ah also I have removed the "PHPExcel_" part in IOFactory.php file any solution for this issue? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload