how to insert image when explort excel file

Sep 5, 2011 at 6:58 AM

In the sample insert image to excel file, it's insert to first column and first row (A1).


$gdImage = imagecreatefromjpeg('images/officelogo.jpg');
// Add a drawing to the worksheetecho date('H:i:s') . " Add a drawing to the worksheet\n";
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('Sample image');$objDrawing->setDescription('Sample image');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');$objWriter->save(str_replace('.php', '.xlsx', __FILE__));

Now, i want to insert image to another column and row (G3 example) .. so how to do it ?

Nov 24, 2011 at 4:37 PM
Edited Nov 24, 2011 at 4:47 PM

Puede Utilizar:

$objDrawing = new PHPExcel_Worksheet_Drawing();  // PHPExcel_Worksheet_MemoryDrawing