samilo
(Samiloxphp)
November 11, 2012, 1:07pm
1
Hi All
I need to read Excle file then insert it into my table So i used " yexcel" extension but I had this error after install
Property "CWebApplication.yexcel" is not defined.
extension link :
http://www.yiiframew …xtension/yexcel
Can any one help ?
Thanks in advance
Keith
(Kburton)
November 12, 2012, 9:06am
3
Can you post your config? Also, the code where you call the extension may be helpful.
samilo
(Samiloxphp)
November 12, 2012, 11:25am
4
Thank you Keith for your comment :
main.php
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
/// Excel
'yexcel' => array(
'class' => 'ext.yexcel.Yexcel'
),
//...../
Controller
public function actionImpoertexcel()
{
Yii::import('ext.yexcel.Yexcel');
$sheet_array = Yii::app()->yexcel->readActiveSheet('example.xls');
echo "<table>";
foreach( $sheet_array as $row ) {
echo "<tr>";
foreach( $row as $column )
echo "<td>$column</td>";
echo "</tr>";
}
echo "</table>";
//$this->render('impoertexcel',array('data'=>$data));
}
Error message
include(PHPExcel_Shared_ZipStreamWrapper.php): failed to open stream: No such file or directory
thanks in advance
Keith
(Kburton)
November 12, 2012, 11:35am
5
See if this page helps you:
http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii/
I’m surprised that the Yii extension doesn’t take care of this problem itself, but it seems like this is the issue. I’ve had to make these changes in my own projects to get PHPExcel to work.
abennouna
(Abennouna)
November 12, 2012, 11:49am
6
Check Yexcel.php source code and see if you can’t do it manually with the help of the link Keith posted in order to fix autoload issues.