Chart Legend missing after chart is copied

Topics: User Forum
Oct 30, 2014 at 11:17 AM
Hello everyone.
I have problem when copying sheet from template file to my new PhpExcel object. In template file I have charts that I need to copy, so everything works fine and charts are copied, but there is no Legend labels, they are missing. I used ->copy() method and clone, but the problem persists. Below is my code:

$inputFileName = TEMPLATES.'/chartTemplate.xlsx';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setLoadSheetsOnly('ChartSheet');
$objReader->setIncludeCharts(TRUE);
$objPHPExcelTemplate = $objReader->load($inputFileName);
$templateSheet = clone $objPHPExcelTemplate->getSheetByName("ChartSheet");
$templateSheet->setTitle('NewChartSheet');
$templateSheetIndex = 4;
$objPHPExcel->addExternalSheet($templateSheet, $templateSheetIndex);

Any suggestions, thanks in advance :)