I am trying to use Symfony2 how can I export an html table to an Excel file with php who can help me
2 Answers
You can use Symfony2 bundles with such a functionality.
For example: https://github.com/liuggio/ExcelBundle should do.
It provides dependency injection and easy creation of PHPExcel objects. Use composer to manage dependencies and automatically load required libraries.
2 Comments
user1794019
hello I used this method to export a table I'm displaying the content but not much I have, as séparteur: (
user1794019
$filename = "export_".date("Y_m_d").".xls"; $response=$this->render('AdminBlogBundle:GestionAlerte:excel.html.twig', array('listes'=>$listes)); $response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8'); $response->headers->set('Content-Disposition', 'attachment; filename='.$filename); $response->headers->set('Pragma', 'public'); $response->headers->set('Cache-Control', 'maxage=1');