sql >> Base de Datos >  >> RDS >> Mysql

exportar phpexcel a excel con imagen

Gracias por ayudarme. He encontrado la respuesta a mi propia pregunta.

    <?php

    $rowNumber = 12;
    foreach($list as $data){
$this->excel->getActiveSheet()->setCellValue('A'.$rowNumber, $data->code_caption)
->setCellValue('B'.$rowNumber, $data->color);

if(file_exists('./media/img/gallery/items/'.$data->image.'TH.jpg'))
{
    $objDrawing = new PHPExcel_Worksheet_Drawing();
    $objDrawing->setPath('./media/img/gallery/items/'.$data->image.'TH.jpg');
    $objDrawing->setCoordinates('C'.$rowNumber);
    $objDrawing->setWorksheet($this->excel->getActiveSheet());
    $this->excel->getActiveSheet()->getRowDimension($rowNumber)->setRowHeight(120);
}
else
{
    $this->excel->getActiveSheet()->setCellValue('C'.$rowNumber, '');
}

$this->excel->getActiveSheet()->setCellValue('D'.$rowNumber, $data->desc);
$this->excel->getActiveSheet()->setCellValue('E'.$rowNumber, $data->$d_met);
$this->excel->getActiveSheet()->setCellValue('F'.$rowNumber, $data->$w_met);
$this->excel->getActiveSheet()->setCellValue('G'.$rowNumber, $data->$h_met);
$this->excel->getActiveSheet()->setCellValue('H'.$rowNumber, $data->qty);
$this->excel->getActiveSheet()->setCellValue('I'.$rowNumber,$data->$cur_dat);           
$this->excel->getActiveSheet()->setCellValue('J'.$rowNumber,$data->$total_price);
$rowNumber++;
    }?>