to load the same design in all sheets

Topics: Developer Forum, Project Management Forum, User Forum
May 18, 2010 at 3:52 PM
Edited May 18, 2010 at 3:53 PM

Hi all,

 

       I am having a template file which has only one sheet. I am using the template as the base and try to generate more than 90 sheets for 90 different countries. But the problem i am facing right now is, if i am using that template file,

I can only see the design in the first sheet, but the rest of the tabs shows only the value, but there is no design. I've tried the same design in another sheet in the template , then in the output, i am getting two sheets designed. Is there anyway to make it more dynamic, means i want to have only one sheet design template which should apply to all the tabs in the output excel file. 

 

Please help me asap

 

Thanks & Regards

Satdev

Coordinator
May 19, 2010 at 11:40 PM

Load the template and use the worksheet copy() method (or clone) remembering to retitle each copied/cloned worksheet

May 21, 2010 at 11:19 AM

Hi  Mark,

 

               I have tried to copy a sheet and tried to add an external sheet for 85 times.  But it shows the setActiveIndex out of bounds exception and some times it shows undefined object sheet I have included a small piece of code

of which i am trying with. 
Please correct the issue and help me

<?

require_once('../../../include/conf.inc.php');

$i = 0;
$copiedSheet = "";
$countryArray = array();
$objPHPExcel = $objReader->load('../excel_templates/q4full.xls');
$copiedSheet = $objPHPExcel->getActiveSheet()->copy();
$objPHPExcel->removeSheetByIndex(0);
foreach($countryArray as $ck =>$cv) {
   
   $objPHPExcel->addExternalSheet($copiedSheet);
    $objPHPExcel->setActiveSheetIndex($ck);
    $objPHPExcel->getActiveSheet()->setTitle($cv);
}
?>

 

Thanks

Satdev