I just want to display a Excel file existing on my hardisk in a twig view.
I'm using Symfony[2.5] and "Liuggio/Excelbundle"
This trick works well but i want to add it in my view.
public function newAction()
{
$filename = 'filename.xlsx';
$reader = \PHPExcel_IOFactory::createReaderForFile($filename);
$excel = $reader->load($filename);
$writer = \PHPExcel_IOFactory::createWriter($excel, "HTML");
$writer->generateStyles();
$writer->generateSheetData();
// this doesnt work..
return $this->render('MonextReportingBundle:Default:excel.html.twig', array(
'excelHtml'=>$writer
));
And in my excel.html.twig :
{{ excelHtml | raw }}
Catchable fatal error: Object of class PHPExcel_Writer_HTML could not be converted to string
Thanks a lot guys ! Excuse my english..
excelHtml.generateSheetData | raw?