From: http://www.yeephp.com/study/919.html
Phpexcel is a very powerful MS Office EXCEL file generation class library, when you need to output more complex format data, phpexcel is a good choice.
After carefully studying the API documentation and viewing official documentation, I finally found the image in Excel. Currently, I can only read the image in Excel 2003 format. Excel2007 does not seem to be supported yet.
The main APIs are phpexcel_worksheet, phpexcel_worksheet_basedrawing, and phpexcel_worksheet_memorydrawing.
Put it bluntly.Code:
Require_once './Classes/phpexcel. php' ; $ Objphpexcel = New Phpexcel (); $ Objreader = Phpexcel_iofactory: createreader ('excel5 '); // Load the 2003 $ Objphpexcel = $ Objreader -> Load ("goods_list.xls "); // Load files Foreach ( $ Objphpexcel -> Getsheet (0)-> getdrawingcollection () As $ K => $ Drawing ){ $ Codata = $ Drawing -> Getcoordinates (); // Obtain unit data, such as G2 Unit $ Filename = $ Drawing -> Getindexedfilename (); // File Name Ob_start (); Call_user_func ( $ Drawing -> Getrenderingfunction (), $ Drawing -> Getimageresource ()); $ Imagecontents = Ob_get_contents (); File_put_contents ('Pic /'. $ Codata .'_'. $ Filename .'.Jpg ', $ Imagecontents ); // Save the file locally Ob_end_clean ();}