losing logo image and dropdowns list after editing exist excel file using PHPExcel in symfony2&3

I have a problem after editing exist excel file using PHPExcel in symfony2&3, I lose the logo image and dropdowns list from the edited file, here’s my code

$phpExcelObject = $this->get('phpexcel')->createPHPExcelObject($pathfile);

    $phpExcelObject->setActiveSheetIndex(0)
    ->setCellValue('D33', $name)
    ->setCellValue('D29', $client)
    ->setCellValue('I41', $adress)
    ->setCellValue('D43', $codePostal)
    ->setCellValue('D35', $email)

     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="namefile.xlsx"');
    header('Cache-Control: max-age=0');

    // If you're serving to IE 9, then the following may be needed
    header('Cache-Control: max-age=1');

    header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
    header ('Pragma: public'); // HTTP/1.0

    $writer = $this->get('phpexcel')->createWriter($phpExcelObject, 'Excel2007');
    $writer->save('php://output');
    exit;

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *