eycopia / excel
PHPEXCEL 包装器
Requires
- php: >=5.3
- phpoffice/phpexcel: ^1.8
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is not auto-updated.
Last update: 2024-09-23 06:17:53 UTC
README
当 A=0, B=1, C=2... 等等时,单元格工作方式类似于数组。行从 1 开始初始化,类似于 Excel。
#创建
$excel = new Excel('公司名称');
#向单元格添加文本
setValue($cell, $row, $value)
$excel->setValue(1, 1, "事件");
在 B:1 添加单词 "事件"
#合并 $excel->merge(1,1, 3, true);
#背景单元格 $excel->backgroundCell("#fff000", 1,1);
#下载 $excel->download('fileName');
#保存如果需要将 Excel 数据存储在变量中 $data = $excel->save();
#完整示例 $excel = new Excel('EyCopia');
$excel->merge(1,1, 3, true);
$excel->setValue(1, 1, "事件");
$excel->backgroundCell("#fff000", 1,1);
$excel->setValue(0, 2, "天数", true);
$excel->setValue(1, 2, "星期一", true);
$excel->setValue(2, 2, "星期二", true);
$excel->setValue(3, 2, "星期三", true);
$excel->setValue(0, 3, "黑客马拉松", true)
->setValue(1, 3, "12", true)
->setValue(2, 3, "34", true)
->setValue(3, 3, "15", true);
$excel->setValue(0,4, "网络活动", true)
->setValue(1,4, "10", true)
->setValue(2,4, "12", true)
->setValue(3,4, "43", true);
$excel->download('juan');