duplicateStyleArray applied across sheets

Topics: Developer Forum, User Forum
Mar 8, 2009 at 9:39 PM
Edited Mar 8, 2009 at 9:40 PM
Hi!

I have a template excel file in 2007 format with one sheet which i open, duplicate that sheet some times, add some lines and apply a style using:

for ($s=0; $s < $it; $s++){
    // clone/duplicate sheet:
    if ($s < $it - 1){
        $clonedSheet = $objPHPExcel->getActiveSheet()->copy();
        $objPHPExcel->addSheet($clonedSheet);
    }
}

for ($t=0; $t < $it; $t++){
    // Set Active Sheet
    $objPHPExcel->setActiveSheetIndex($t);

    // ... write data ...

    $objPHPExcel->getActiveSheet()->duplicateStyleArray(
        array('borders' => array(
                    'right'  => array('style' => PHPExcel_Style_Border::BORDER_THIN),
                     'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
                     'left'   => array('style' => PHPExcel_Style_Border::BORDER_THIN)
                    )
            ),'C'.$t.':Q'.$t);
// ... etc...

The problem is that this style is applied accross all sheets and not on the active one.
What am i doing wrong?
Developer
Mar 8, 2009 at 11:25 PM
A work item has been created for this:
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=9463