Recently i have used phpExcel library to generate reports in excel format in cakephp. Every thing is working fine except pivot Tables.
I am using a master excel sheet (Which contain pivot table) to clone/generate other excel sheet. In newly generated sheet other information is looking fine but pivot table is not being generated (only names on header are being display. There is no filter options). Here is the code i am using.
$filename = WWW_ROOT."files/master_report_template/compliance_workflow_master_template.xlsx";
$reportFileName = WWW_ROOT."files/documents/reports/compliance_workflow_template.xlsx";
$this->PhpExcel->loadWorksheet($filename);
$this->PhpExcel->getActiveSheet()->setCellValue('B1',$this->request->data['fromDate']);
$this->PhpExcel->getActiveSheet()->setCellValue('B2',$this->request->data['toDate']);
$this->PhpExcel->getActiveSheet()->setCellValue('B3',date('D-M-y'));
$row=6;
foreach($repostData as $rows)
{
$col = 0;
foreach($rows as $key =>$value)
{
$this->PhpExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, $value);
$col++;
}
$row++;
}
$this->PhpExcel->save($reportFileName);
$this->PhpExcel->output();
I thought that generated excel sheet would be the clone of Master excel sheet but both are not same (due to pivot tables). Is there any good tutorial or documentations to generate pivot table ?