欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

PHPExcel 读写封装类

程序员文章站 2022-05-10 12:20:12
...
  对于 excel 文件的的生成于数据读取,我们可以用到 PHPExcel 插件。地址:http://phpexcel.codeplex.com/releases/view/107442 ,选第一个下载。然后解压的文件目录如下:

  初学者应该先去看示例,代码不是很难理解。方法名都是观其名,知其用。在看过些许例子的基础上,我才想到封装一下,用着方便。鉴于我自己也只是入门。所以写了个相对入门的封装。

 
文件:
'Excel/Classes/PHPExcel.php' myExcel ; parent:: '标题', 'creator' => '作者'); setProperty( ->objProperty = -> (!(['creator']))->objProperty->setCreator(['creator' (!(['title'])) ->objProperty->setTitle(['title' (!(['subject']))->objProperty->setSubject(['subject' (!(['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(