Tag Archives: Yii Excel

Custom SQL Query To Excel In Yii1.0

Please read this tutorial before to follow this post. https://www.bsourcecode.com/2013/04/yii-cactivedataprovider-to-excel/ This tutorial will help you to create a excel sheet using custom sql query. In Model Code public function searchbydocumentdetails(){ $query=”SELECT * FROM TABLE_NAME”; return new CSqlDataProvider($query, array( ‘pagination’=>false ) ); } In Controller Code public function customsqltoexcel(){ $document=new Document; $data=$document->searchbydocumentdetails(); $this->toExcel($data, array(‘DocuemntName’, ‘CategoryName’, ‘DownloadCredits’, ‘UploadCredits’, […]