Using images with fromArray

Topics: User Forum
Sep 9, 2014 at 9:34 AM
Hi there,

I am currently printing out data to an excel sheet and each piece of data has an image associated to it. I would like to do something like:
...
$table = array();
foreach($dataset as $data){
    $drawing = new PHPExcel_Worksheet_MemoryDrawing();
    $drawing->setImageResource($data->getImage());
    ...
    $table[] = array($drawing);
}
$objPHPExcel->getActiveSheet()->fromArray($table);
...
Sadly fromArray does not seem to accept drawings inside the array. But I also do not want to statically set the coordinates of every image myself.
Is there a way to make this work or do I have to rewrite my code to use iterators instead of fromArray?
Coordinator
Sep 9, 2014 at 10:58 AM
fromArray() is used to put content inside cells (in the same way as, for example, setCellValue()); but in Excel, images aren't stored inside cells, they are overlaid, effectively displayed over the cell, so fromArray() can never be used with images....
The actual positioning of an overlaid image can be relative to the top-left corner of a cell, with x and y offsets, but otherwise it has no direct connection to any cell