CakePHP 2.x - Excel reader/writer integration -
is familiar integrating excel reader/writer export in cakephp 2.x? appreciated.
thanks in advance! peace. xd
simpliest answer is:
download phpexcel https://phpexcel.codeplex.com/releases/view/119187
extract content of classes folder app/vendor
directory.
in controller create function like:
public function toexcel(){ app::import('vendor', 'phpexcel', array('file' => 'phpexcel.php')); $objphpexcel = new phpexcel(); $objphpexcel->removesheetbyindex(0); // code here // save file $objwriter = new phpexcel_writer_excel2007($objphpexcel); $filenamewithpath = tmp.'reports/test.xlsx'; $objwriter->save($filenamewithpath); // response - let user download $this->response->file($filenamewithpath, array('download' => true, 'name' => $filename)); return $this->response; }
read documentation know next
Comments
Post a Comment