Add a page?

Topics: User Forum
Dec 26, 2008 at 6:00 PM
I've tried the function "addSheet()" in several ways and was never able to make it work out. I found a way to make it work when you copy the first sheet on this discussion board (pasted below), but I suppose then I'd have to clear everything. I try to test out any way I can think of that may work before asking for help...but this one seems easy but I just don't have the resources to make any headway with it.

// copy sheet
$page2 = $objPHPExcel->getActiveSheet()->copy();
$page2->setCellValue('B1', 'TEST');

This is probably a walk in the park for most of you...but I appreciate it :P
Dec 26, 2008 at 9:53 PM
Easiest way to add sheet:

$objWorksheet = $objPHPExcel->createSheet();

Under the hood, createSheet() uses addSheet() like this, which also works:

$objWorksheet = new PHPExcel_Worksheet($objPHPExcel);

But again, createSheet() is probably easier, so just use that.