Hpexcel is a fairly powerful MS Office Excel document Generation Class library, and Phpexcel is a good choice when it comes to outputting more complex format data.
After careful study of the API documentation and viewing the official documents, I finally found the picture in Excel, which I can only read in Excel 2003 format. Excel2007 doesn't seem to support it. The main API used is phpexcel_worksheet,phpexcel_worksheet_basedrawing,phpexcel_worksheet_memorydrawing.
Less nonsense, directly on the code:
Copy Code code as follows:
Require_once './classes/phpexcel.php ';
$objPHPExcel = new Phpexcel ();
$objReader = Phpexcel_iofactory::createreader (' Excel5 '); Load 2003 of
$objPHPExcel = $objReader->load ("Goods_list.xls"); Loading files
foreach ($objPHPExcel->getsheet (0)->getdrawingcollection () as $k => $drawing) {
$codata = $drawing->getcoordinates (); Get the cell data, like the G2 unit.
$filename = $drawing->getindexedfilename (); Filename
Ob_start ();
Call_user_func (
$drawing->getrenderingfunction (),
$drawing->getimageresource ()
);
$imageContents = Ob_get_contents ();
File_put_contents (' pic/'. $codata. _ '. $filename. '. JPG ', $imageContents); Save the file to the local
Ob_end_clean ();
}