[Into] Using phpexcel to read images in Excel

Source: Internet
Author: User

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  ();} 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.