PHP excel read/write package _ PHP Tutorial

Source: Internet
Author: User
PHPExcel read/write encapsulation class. The PHPExcel plug-in can be used to generate excel files for data reading. Address: phpexcel. codeplex. comreleasesview107442. select the first download. After decompression, we can use the PHPExcel plug-in to generate an excel file for data reading. Address: http://phpexcel.codeplex.com/releases/view/107442, select the first download. The decompressed file directory is as follows:

Beginners should first look at the example, the code is not very difficult to understand. The method names are all for observation and use. On the basis of looking at some examples, I just thought of encapsulating it for convenience. Because I am just getting started. Therefore, a relatively entry-level encapsulation is written.

   
 'Author '); setProperty (-> objProperty =-> (! (['Creator'])-> objProperty-> setCreator (['creator '(! (['Title'])-> objProperty-> setTitle (['title '(! (['Subobject'])-> objProperty-> setSubject (['subobject '(! (['Laster'])-> objProperty-> setLastModifiedBy (['laster '(! (['Description'])-> objProperty-> setDescription (['description '(! (['Keyword'])-> objProperty-> setKeywords (['keyword '(! (['Category'])-> objProperty-> setCategory (['category' 'a111', 'b1 '=> 'b222 ', 'C1' => 'c111',); addData (, = ()? -> SetActiveSheetIndex ():-> (=> () | ()-> setCellValue (, saveFile (, =, = 'excel5'-> objWriter = PHPExcel_IOFactory :: createWriter (, =. -> objWriter-> save (setReader (, =-> = (-> =-> objReader = PHPExcel_IOFactory: createReader ()-> load (}-> = PHPExcel_IOFactory :: identify (-> objReader = PHPExcel_IOFactory: load (loadFile (, =-> setReader (,-> sheetData =-> objReader-> getActiveSheet ()-> toArray (,, DataFormat (, = 1, = (-> sheetData => (& <) (&>) (=> ((, [] [[] = (sheetInfo (= ()?: =-> ObjReader-> listWorksheetInfo (= './upImg/' = .'aaa.xls '(! () (, 0777,) or ('upload directory creation failed! '= ['Files'] ['tmp _ name' (,); = 'title' => 'title ', 'Creator' => 'author '= 'A1' => 'a1111', 'A2' => 'a222', 'b1 '=> 'b111 ', 'e1 '=> 'e111', 'F2' => 'f22222' = 'G2 '=> 'f22222', 'h1 '=> 'hhh ', 'j1' => 'jjjjjj '= setProperty ($ property); addData ($ data, 0); addData ($ data2); saveFile('aaa.xls '); -> loadFile ('upimg/aaa.xls '= ('a' => 'name', 'E' => 'age ', 'F' => 'address' =-> dataFormat (, 5 (?>

The configuration returned by the data can be viewed as follows:

The excel file is generated for data reading. we can use the PHPExcel plug-in. Address: http://phpexcel.codeplex.com/releases/view/107442, select the first download. Decompress the file...

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.