zoukankan      html  css  js  c++  java
  • Phpexcel使用

    在看正文之前,友情提示程序员兄弟(姐妹),尽量不要久坐,多起来走动走动咯。有个好身体,才能再干它20年嘛!

    前言

    之前在处理表格相关的需求时,写表格我用的table的方式,读的话我是先将excel文件转换成csv,然后根据行和“,”分隔符进行内容读取。但是这样不是很灵活,遇到一些特殊字符,像换行什么的,还容易出问题,所以今天就简单地学习了一下phpexcel。

    学习方法

    phpexcel的学习建议大家主要看这里:https://github.com/PHPOffice/PHPExcel ,然后再结合网上一些资料。

    安装

    安装方法在github的项目说明里有:

    install.txt的内容是:

    Requirements
    ------------
    
    The following requirements should be met prior to using PHPExcel:
    * PHP version 5.2.0 or higher
    * PHP extension php_zip enabled *)
    * PHP extension php_xml enabled
    * PHP extension php_gd2 enabled (if not compiled in)
    
    *) php_zip is only needed by PHPExcel_Reader_Excel2007, PHPExcel_Writer_Excel2007,
       PHPExcel_Reader_OOCalc. In other words, if you need PHPExcel to handle .xlsx or .ods
       files you will need the zip extension, but otherwise not.
    
    
    
    Installation instructions
    -------------------------
    
    Installation is quite easy: copy the contents of the Classes folder to any location
    in your application required.
    
    Example:
    
    If your web root folder is /var/www/ you may want to create a subfolder called
    /var/www/Classes/ and copy the files into that folder so you end up with files:
    
    /var/www/Classes/PHPExcel.php
    /var/www/Classes/PHPExcel/Calculation.php
    /var/www/Classes/PHPExcel/Cell.php
    ...
    
    
    
    Getting started
    ---------------
    
    A good way to get started is to run some of the tests included in the download.
    Copy the "Examples" folder next to your "Classes" folder from above so you end up with:
    
    /var/www/Examples/01simple.php
    /var/www/Examples/02types.php
    ...
    
    Start running the test by pointing your browser to the test scripts:
    
    http://example.com/Examples/01simple.php
    http://example.com/Examples/02types.php
    ...
    
    Note: It may be necessary to modify the include/require statements at the beginning of
    each of the test scripts if your "Classes" folder from above is named differently.

    使用

    写可以参考这个文件。读可以参考这个文件。

  • 相关阅读:
    (转)Linux下/etc/rc.local与/etc/init.d的区别与联系
    (转)谈免驱
    (转)获取android源码时repo的错误
    (转)platform_driver_register,什么时候调用PROBE函数 注册后如何找到驱动匹配的设备
    (转)typedef 函数指针的用法
    (转)分析kernel的initcall函数
    (转)Tiny210v2( S5PV210 ) 平台下 FIMD 对应 的 framebuffer 驱动中,关于 video buffer 的理解
    tiny210V2开发板hdmi输出到10.1寸LCD,无图像
    (转)学习linux的几本书
    (转)RGB接口和i80接口的区别
  • 原文地址:https://www.cnblogs.com/doubilaile/p/8309478.html
Copyright © 2011-2022 走看看