Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've used PHPExcel with CodeIgniter successfully before.</p> <p>All I did was drop the phpexcel folder into application/third-party and created the following wrapper library:</p> <pre><code>&lt;?php class Excel { private $excel; public function __construct() { // initialise the reference to the codeigniter instance require_once APPPATH.'third_party/phpexcel/PHPExcel.php'; $this-&gt;excel = new PHPExcel(); } public function load($path) { $objReader = PHPExcel_IOFactory::createReader('Excel5'); $this-&gt;excel = $objReader-&gt;load($path); } public function save($path) { // Write out as the new file $objWriter = PHPExcel_IOFactory::createWriter($this-&gt;excel, 'Excel5'); $objWriter-&gt;save($path); } public function stream($filename) { header('Content-type: application/ms-excel'); header("Content-Disposition: attachment; filename=\"".$filename."\""); header("Cache-control: private"); $objWriter = PHPExcel_IOFactory::createWriter($this-&gt;excel, 'Excel5'); $objWriter-&gt;save('php://output'); } public function __call($name, $arguments) { // make sure our child object has this method if(method_exists($this-&gt;excel, $name)) { // forward the call to our child object return call_user_func_array(array($this-&gt;excel, $name), $arguments); } return null; } } ?&gt; </code></pre> <p>I could then do the following in my controllers:</p> <pre><code>$this-&gt;load-&gt;library("excel"); $this-&gt;excel-&gt;load("/path/to/input.xls"); $this-&gt;excel-&gt;setActiveSheetIndex(0); $this-&gt;excel-&gt;getActiveSheet()-&gt;SetCellValue('B2', "whatever"); $this-&gt;excel-&gt;save("/path/to/output.xls"); </code></pre> <p>Hope this helps you out?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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