Developing PHP code that will create Excel file using PHP Excel.
I need to place an image into XLS file. Problem I have is that dimension of the image are not the one I defined in my code:
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Water_Level');
$objDrawing->setDescription('Water_Level');
$objDrawing->setPath('img/logo-rab.jpg');
$objDrawing->setHeight(74);
$objDrawing->setCoordinates('A1');
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
This image is much higher than 74 pixels. Tried to add height and width also, but always the same.
Can you help me how to add image in my XLS, with dimensions I defined in PHP code?
Thank you in advance!
Have you tried using setWidthAndHeight and set ResizeProportional true?
$objDrawing->setWidthAndHeight(148,74);
$objDrawing->setResizeProportional(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With