Unable to make multiple pdf pages/sheet

Topics: Developer Forum, Project Management Forum, User Forum
Jul 11, 2014 at 11:06 AM
Below is my code. I am trying to make multiple pages in pdf but didn't find any solution.. where am i wrong.

and one thing more. i cant style properties like setting font, color when i merge cells.
Please help

Thanks

<?php
require_once 'PHPexel/Classes/PHPExcel.php';
//require_once 'PHPExcel/IOFactory.php';

// Create new PHPExcel object

$libsPath = $pathDetails['dirname'];
$classPath = 'PHPexel/Classes/';
if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/* Include PHPExcel /
require_once $classPath . 'PHPExcel.php';
// Change these values to select the Rendering library that you wish to use and its directory location on your server
$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
$rendererLibraryPath = $classPath . 'dompdf';
// Create new PHPExcel object


$objPHPExcel = new PHPExcel();

// Create a first sheet, representing sales data
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Something');

// Rename sheet
$objPHPExcel->getActiveSheet()->setTitle('Name of Sheet 1');

// Create a new worksheet, after the default sheet
$objPHPExcel->createSheet();

// Add some data to the second sheet, resembling some different data types
$objPHPExcel->setActiveSheetIndex(1);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'More data');

// Rename 2nd sheet
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->getActiveSheet()->setShowGridLines(false);

if (!PHPExcel_Settings::setPdfRenderer(
    $rendererName,
    $rendererLibraryPath
)) {
die(
    'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
    '<br />' .
    'at the top of this script as appropriate for your directory structure'
);
}

// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="01simple.pdf"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->save('php://output');
exit;