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...