I just want to display a Excel file in a twig view with a Symfony2.5 Controller.
With PHPExcel, I can do this trick and it works :
<?php
error_reporting(E_ALL ^ E_NOTICE);
require_once '/../Classes/PHPExcel.php';
$filename = 'filename.xlsx';
$reader = PHPExcel_IOFactory::createReaderForFile($filename);
$excel = $reader->load($filename);
$writer = PHPExcel_IOFactory::createWriter($excel, "HTML");
?>
<html>
<head>
</head>
<style>
<?php
echo $writer->generateStyles(true);
?>
</style>
<body>
<?php
echo $writer->generateSheetData();
?>
</body>
</html>
How can I do the same thing in my Controller in Symfony 2.5 ?
Actually i have this :
public function newAction()
{
$filename = 'filename.xls';
$reader = \PHPExcel_IOFactory::createReaderForFile($filename);
$excel = $reader->load($filename);
$writer = \PHPExcel_IOFactory::createWriter($excel, "HTML");
echo $writer->generateStyles();
echo $writer->generateSheetData();
}
What should i have in my render view ?
Thanks for help !