Toexcel Export

Hi,

i’m using the EExcelBeahvior extension to export to excel, the problem is that i can’t find the generated file?

my action is :




$model = MyModel::model()->findByPk('20');

		$this->toExcel($model,

			array(

				'id',

				),

			'report',

			array('creator'=>'me'),

			'Excel2007'

		);

		$dataProvider=new CActiveDataProvider('MyModel');

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

		));



Thanks

read the source code ! this extension can both saving to a file and as a download file





	//create writer for saving

			$objWriter = PHPExcel_IOFactory::createWriter(self::$objPHPExcel, $this->exportType);

			if(!$this->stream)

				$objWriter->save($this->filename);

			else //output to browser

			{

				if(!$this->filename)

					$this->filename = $this->title;

				ob_end_clean();

				header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

				header('Pragma: public');

				header('Content-type: '.$this->mimeTypes[$this->exportType]['Content-type']);

				header('Content-Disposition: attachment; filename="'.$this->filename.'.'.$this->mimeTypes[$this->exportType]['extension'].'"');

				header('Cache-Control: max-age=0');

				$objWriter->save('php://output');

				die() ;  //Yii::app()->end();

			}

this is how this extension handle the exported result :lol:

thanks a lot, i view the source i fixed some problems in my code and it works.

Please explain more, I am new bee and need some help to understand it.