I'm working in phalcon php framework and i am trying to create simple xsl file, but when i call my controller i get empty excel table. Can anyone tell me what is wrong in my code. Here is my method:
public function createExcelAction(){
$loader = new \Phalcon\Loader();
$loader->registerClasses(
array(
"PHPExcel"=>"C:/wamp/www/phalcon1/Classes/PHPExcel.php",
"PHPExcel_Writer_Excel2007"=>"C:/wamp/www/phalcon1/Classes/PHPExcel/Writer/PHPExcel_Writer_Excel2007.php"
)
);
$loader->register();
$excel = new PHPExcel();
//$excel = new PHPExcel();
//activate worksheet number 1
$excel->setActiveSheetIndex(0);
//name the worksheet
$excel->getActiveSheet()->setTitle('test worksheet');
//set cell A1 content with some text
$excel->getActiveSheet()->setCellValue('A1', 'Rezultati pretrage');
$excel->getActiveSheet()->setCellValue('A2', "Ime");
$excel->getActiveSheet()->setCellValue('C2', "Prezime");
$excel->getActiveSheet()->setCellValue('F2', "Adresa stanovanja");
$br = rand(0,1000000);
$naziv = "Pobjeda-Rudet izvjestaj-".$br.".xls";
//$filename='pobjeda_rudet.xlsx'; //save our workbook as this file name
header('Content-Type: application/vnd.ms-excel'); //mime typež
header('Content-Disposition: attachment;filename="'.$naziv.'"');
// header('Content-Disposition: attachment;filename="'.$filename.'"');
header('Cache-Control: max-age=0'); //no cache
$objWriter = new PHPExcel_Writer_Excel2007($excel);
$objWriter->save(str_replace('.php', '.xls', __FILE__));