Adding Image to the Excel in phpexcel in php

后端 未结 3 1477
慢半拍i
慢半拍i 2020-12-29 23:26

I am taking the example from phpexcel

I just tried with passing value in GET Method, I am done with that.

Now i am trying to add image in the a3 coloumn.

<
3条回答
  •  孤城傲影
    2020-12-29 23:31

    Read my article,

    http://www.7codes.info/post/8/export-excel-files-with-images-using-php-excel-library

    $objDrawing = new PHPExcel_Worksheet_Drawing();    //create object for Worksheet drawing
    $objDrawing->setName('Customer Signature');        //set name to image
    $objDrawing->setDescription('Customer Signature'); //set description to image
    $signature = $reportdetails[$rowCount][$value];    //Path to signature .jpg file
    $objDrawing->setPath($signature);
    $objDrawing->setOffsetX(25);                       //setOffsetX works properly
    $objDrawing->setOffsetY(10);                       //setOffsetY works properly
    $objDrawing->setCoordinates($column.$cell);        //set image to cell
    $objDrawing->setWidth(32);                 //set width, height
    $objDrawing->setHeight(32);  
    
    $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());  //save
    

提交回复
热议问题