Export excel template with data to pdf

Topics: Developer Forum
Sep 16, 2014 at 7:40 AM
Hi all,
I'm using phpexcel to convert excel to pdf, but not working. I have follow 01simple-download-pdf.php and it run, but my code not working. This is my code:
$objReader = new \PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load("Simple_Template.xlsx");

$rendererName = \PHPExcel_Settings::PDF_RENDERER_TCPDF;
$rendererLibrary = 'tcpdf';
$rendererLibraryPath = Yii::getAlias('@urlLibraryPdf').'/'.$rendererLibrary;
if (!\PHPExcel_Settings::setPdfRenderer(
)) {
          'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
          '<br />' .
          'at the top of this script as appropriate for your directory structure'
                $filename = 'simple.pdf';
                header('Content-Type: application/pdf');
                header("Content-Disposition: attachment; filename=\"$filename\"");
                header('Cache-Control: max-age=0');

                $objWriter = new \PHPExcel_Writer_PDF($objPHPExcel);
                // $sobjWriter->writeAllSheets();
I think problems at:
$objReader = new \PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load("Simple_Template.xlsx");
instead of:
$objPHPExcel = new PHPExcel();
then set value for each cell.

Can anyone show me how to convert template excel to pdf?
Sep 16, 2014 at 7:14 PM
What makes you think the problem is with the data load? And what debugging steps have you taken to try and find out what the problem is? Are there any error messages? Has anything been written to the PHP or Webserver logs?