Jump to content

export images from folder to excel file using php


dsr

Recommended Posts

You may use following code to insert image in Excel with the help of Php:

 

$fileType = 'Excel2007';

$fileName = 'test.xlsx';

 

// Load the workbook

$objPHPExcelReader = PHPExcel_IOFactory::createReader($fileType);

$objPHPExcel = $objPHPExcelReader->load($fileName);

 

// Add an image to the worksheet

$objDrawing = new PHPExcel_Worksheet_Drawing();

$objDrawing->setName('My Image');

$objDrawing->setDescription('The Image that I am inserting');

$objDrawing->setPath('./images/myImage.png');

$objDrawing->setCoordinates('B2');

$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());

 

// Save the workbook

$objPHPExcelWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,$fileType);

$objPHPExcelWriter->save($fileName);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.