I am opening an extension by request for my first widget
http://www.yiiframework.com/extension/eexcelview/
About the question:
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).
For example(in controller):
with this code you could achieve what you want by adding a link with parameter 'export'=>true.
I will soon add new features to the class including specifying filename of the downloaded file.

http://www.yiiframework.com/extension/eexcelview/
About the question:
Quote
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??
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).
For example(in controller):
public function actionTest($export = false) { if($export) { $this->widget('EExcelView', array( 'dataProvider'=> new CActiveDataProvider(NetClientType), )); Yii::app()->end(); } else $this->render('view', compact('params'....)); }
with this code you could achieve what you want by adding a link with parameter 'export'=>true.
I will soon add new features to the class including specifying filename of the downloaded file.