aaugustyniak/phpexcelhandler

方便的php-excel包装类

1.0.4 2017-01-22 10:51 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:55:31 UTC


README

Build Status

简化PhpExcel导航和生成报告的API。

PhpExcelHandler

目前这些功能仅在*nix系统下工作。

如果您想用例如填充Excel模板并输出或本地保存,这个包适合您。导航类将PhpExcel单元格选择转换为笛卡尔坐标系。

安装

如果您还没有Composer,您现在应该获取它

  1. 将包添加到您的composer.json

     "require": {
       ...
       "aaugustyniak/phpexcelhandler": "1.0.0",
       ...
     }
    
  2. 安装

     $ php composer.phar install
    
  3. 然后使用

require_once "vendor/autoload.php";

$data = array(
            array("Column1", "Column2", "Column3"),
            array(1001, 2001, 3001),
            array(4001, 5001, 6001),
            array(7001, 8001, 9001),
        );


$phpExcelFactory = new DefaultPhpExcelFactory();
$spreadSheet = new SpreadSheet($phpExcelFactory);

$anchorGuesser = new WriteAnchorGuesser($data);

$writer = new WriteTabularCommand($anchorGuesser);
$spreadSheet->modify($writer);
$outputHtml = $spreadSheet->getHtmlStream();
echo $outputHtml;