Createsheet function is not inserting the page in pdf file

Topics: Developer Forum, Project Management Forum, User Forum
Nov 15, 2010 at 11:40 AM

Hi ,

/** Error reporting */

/** PHPExcel */
require_once 'Classes/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();

// Set properties
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
        ->setLastModifiedBy("Maarten Balliauw")
        ->setTitle("PDF Test Document")
        ->setSubject("PDF Test Document")
        ->setDescription("Test document for PDF, generated using PHP classes.")
        ->setKeywords("pdf php")
        ->setCategory("Test result file");

// Assign cell values
            $objPHPExcel->getActiveSheet()->setCellValue("A1", "cell value here 111");

            $objPHPExcel->getActiveSheet()->setCellValue("A2", "cell value here 2222222222");

            $objPHPExcel->getActiveSheet()->setCellValue("A3", "cell value here 222");

            $objPHPExcel->getActiveSheet()->setCellValue("A4", "cell value here 222");


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

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');


The above code is not showing data  in second page in pdf file.

Nov 15, 2010 at 11:50 AM

It's a good idea to tell the Writer to write all sheets before generating the output with save()

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');


Nov 15, 2010 at 11:53 AM

Hi MarkBaker,

It is working now thank you so much