Add an image to the header/footer

Topics: Developer Forum, Project Management Forum, User Forum
Mar 15, 2013 at 4:15 PM
Edited Mar 15, 2013 at 4:15 PM
I'm sorry but I can not show add my image as header/footer and I don't have any errors. I just put this code:

$objDrawing = new PHPExcel_Worksheet_HeaderFooterDrawing();
$objDrawing->setName('Logo');
$objDrawing->setPath('images/logo.png');
$objDrawing->setHeight(66);
$objDrawing->setWidth(200);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&G&L');

Note : If I put just an image, everything is working fine, but I want to put a header/footer for each page.

/* working fine but i don't need this.
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('images/logo.png');
$objDrawing->setHeight(66);
$objDrawing->setWidth(200);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
*/

Thank's in advance for anyone who can give me a tip.

Christian.
Coordinator
Mar 20, 2013 at 2:51 PM
What Writer are you using for your saved workbook?