PHP code example of jingwu / excel

1. Go to this page and download the library: Download jingwu/excel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jingwu / excel example snippets


本库用于通过数组的形式生成 Excel, 并可将Excel发送到浏览器,写入本地文件等。
本库是基于 https://github.com/rogeriopradoj/php-excel.git 进行的改进。
修改的功能如下:
1. 代码中添加了中文注释
2. 文件名支持中文
3. 去掉了一些兼容性的代码



use Jingwu\Excel\Excel_XML;

$data = array(
    0 => array('ID', '用户名', '邮箱'),
    array(1, '张三', '[email protected]'),
    array(2, '李四', '[email protected]')
);

$xls = new Excel_XML;
$xls->addWorksheet('Names', $data);
$xls->sendWorkbook('test.xml');
//$xls->writeWorkbook('test.xml');