When I try to acces the view automaticaly is created the .xls file ... how can I add a button to donwload the xls generated file?? Cuz I can't assign a name file

this extension hasn't a code into Controller??

As this extension is not realy a view, it does not need to be in a view file. You could(or you'd better) put its code in the controller class. So when you display a gridview which you want to save to a xls file with a button, you could call the controller and in its action you can create EExcelView class and it will call the save file dialog with action.xls (filename will be the action name).

Also, while streaming to browser, name of generated file defaults to name of the action.
I would suggest adding a parameter to set name of the generated file (I have used the parameter "title" in the following example)

This can be done by adding
header('Content-Disposition:attachment; filename="'.$this->title.'"');
after
header($this->mimeTypes[$this->exportType]);

Most useful I found so far. Thanks. I changed a couple of things for putting labeled attributes as headers instead of database fields. (taking advantage of the attributeLabels() function that is in every single model generated by yii). Also, I'm passing parameters for telling the actionExcel (in my case) in the controller, which attributes must be ignored. Finally, I'm checking if exists a function (getAttributeName()) in the model for retrieving human readable values instead of codes. This might be useful if you want to print the correspondent values of foreign keys in your current model. I'll explain it in more detail in the forum

I'm explaining what i did for 'improve' this extension. (I hope someone find this useful. )

Please find attached the modified PHP file. This one includes what Abdul Rehman and Gustavo pointed out.

This last section might be conceptually wrong but it works...
I'm super newbie in yii as well so if you can improve this extension, please do it and let the community know.

cheers!

tried the last version and code and i am getting this error: Fatal error: Class 'CException' not found in /Users/mikaelbortenheim/Sites/PHP/bentsen.client.sysedata.no/yii1.1.7-26apr-dev/framework/YiiBase.php on line 311….

As this extension is not realy a view, it does not need to be in a view file. You could(or you'd better) put its code in the controller class. So when you display a gridview which you want to save to a xls file with a button, you could call the controller and in its action you can create EExcelView class and it will call the save file dialog with action.xls (filename will be the action name).

Hello,
I am new to Yii but I am trying to implement this awesome extension!Thank you for contributing it!
However I am trying to use it and I can't seem to make it work...
I have tried to use the comments in this forum and this is what I have done:
I have added in the protected\views\employee\admin.php of the default application this code

the PHP error is gone but the controller is not working, and I receive this error on my browser:

File not found
Firefox can't find the file at hxxp://website-name.com/admin/product/export.
Check the file name for capitalization or other typing errors.
Check to see if the file was moved, renamed or deleted.

what's weird is the controller is there, and If I delete the widget call, the controller is working.

Does anybody encounter this issue or can advice what should I do?
It's working ok on my local install, does it related to server settings?