You didnt show the part where you are writing your data to the sheet,
so it is hard to tell why it is empty. Make sure you are setting and
referencing the active sheet:

$objPHPExcel->setActiveSheetIndex($activeSheet);
$objPHPExcel->getActiveSheet()->setCellValue($column, $row, $value);

I am using phpexcel and symfony to output data as well, but I write
the file to disk and then present a link to the file:

$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save($filename.".xls");

That works without setting the content headers, maybe that is a
solution for you as well, or at least you can ensure that the  data is
written correctly to your excel file.

On Jun 25, 9:43 pm, diana catalina tobar lara
<catalina.tobar.l...@gmail.com> wrote:
> Hi i have a problem i'm new in symfony, I'm from ecuador sorry if my
> english is not good
>
> i'm using phpexcel to output a excel file but i'm not using the plugin
> for symfony sfExcelReaderPlugin, i just download the classes from
> phpexcel page and paste it in the lib directory. My problem is that
> when I want to download the file, appear the window in the browser
> asking me if i want to open the exportExcel.xls file, iput open and it
> open me excel, but appear a window with a warning that show this
> message:
>
> "The file you are trying to open, 'exportExcel.xls' has a different
> format than specified by the file extension. Verify that file is not
> corrupted and is from a trusted source before opening. Wish you open
> the file now?"
>
> I open the file but it doesn't have nothing the excel is blank.
>
> PLease anyone can help me I don't know what to do. This is my code:
>
> public function executeAscensoPromedios(sfWebRequest $request)
>   {
>
> /** PHPExcel */
> include sfConfig::get('sf_lib_dir').'/PHPExcel_Classes/PHPExcel.php';
> include sfConfig::get('sf_lib_dir').'/PHPExcel_Classes/PHPExcel/Writer/
> Excel5.php';
>
> $this->setLayout(false);
> // Create new PHPExcel object
>
> $objPHPExcel = new PHPExcel();
>
> /********************************************
> HERE I USE PHP EXCEL TO GENERATE MY EXCEL FILE
>
> *****************************************************/
> $this->getResponse()->clearHttpHeaders();
> $this->getResponse()->setHttpHeader('Content-Type:','application/
> msexcel');
> $this->getResponse()->setHttpHeader('Content-
> Disposition:','attachment; filename=exportExcel.xls');
> // Save Excel 5 file
> $error_reporting = error_reporting(0);
> $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
> $xls_data = $this->renderText($objWriter->save());
>
> error_reporting($error_reporting);
> return $xls_data;
>
>   }

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to