Issue
I want to capture html form fields data and save it in a .xlsx file. I looked around and found PHPExcel but couldn't figure out how to integrate it to Yii2. Can someone tell me how to integerate. I want to use something like this in my controller:
require('../PHPExcel.php');
$objPHPExcel = new PHPExcel;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="file.xlsx"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');`
Solution
Add PHPExcel to the project using composer. Then refers to it using @vendor prefix in require('@vendor/...') to reach specific package
Answered By - Ben Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.