$model = new User; $res = $model->findAll(); $data[]=array('Name','Email'); foreach($res as $list) { $data[]=array($list['username'],$list['email']); } Yii::import('application.extensions.phpexcel.JPhpExcel'); $xls = new JPhpExcel('UTF-8', false, 'test'); $xls->addArray($data); $xls->generateXML('News-letter'.date('Y-m-d'));
I am using the above code to generate excel,
Excel is downloding fine, When I opens it it shows that error , file is in different format specified in the file name,
Can any one help me?