fml/phpsimpleexcel

PHPSimpleExcel 是基于 oliverschwarz/php-excel 的库

v1.0.2 2016-03-23 14:19 UTC

This package is not auto-updated.

Last update: 2024-09-18 10:39:29 UTC


README

PHPSimpleExcel 是基于 oliverschwarz/php-excel 的库。此实现允许您通过 startRow() 方法控制当前行,该方法返回 Row 对象。

安装

FunkyMonkeyLabs\PHPSimpleExcel 在 packagist.org (composer) 上可用,因此您只需简单地添加

    "require": {
        "fml/phpsimpleexcel" : "v1.0.0"
    }

用法

<?php

require_once __DIR__.'/vendor/autoload.php';

$excel = new FML\PhpSimpleExcel\PhpSimpleExcel();
$excel->addNamedStyle('idFormat', array(
        "NumberFormat" => array(
            "ss:Format" => "##00"
        )
    ));
$excel->addRow(array(
        "id", "Column1", "Column2"
    ));

foreach(range(0,11) as $id) {
    $excel
        ->startRow()
        ->addCell($id, 'Number', 'idFormat')
        ->addCell('value'.$id)
        ->addCell('value2'.$id)
        ->end();
}
echo $excel->generateXML('excel');