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.

    使用

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

  • 相关阅读:
    tnsnames.ora和listener.ora文件中的几个概念转
    SAP权限概念与设置(转)
    SAP License:HANA在线日志被误删了怎么办?(转)
    SAP ERP to SAP Cloud Platform Integration via Webdispatcher
    DotSpatial 要素删除节点
    DotSpatial 节点编辑
    使新添加的.gitignore生效
    关于netcat(nc)开启监听有趣的发现
    Gluster FS故障修复
    Git去除SSL验证
  • 原文地址:https://www.cnblogs.com/doubilaile/p/8309478.html
Copyright © 2011-2022 走看看