gri3li/yii2-grid-file 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gri3li/yii2-grid-file

最新稳定版本:v1.3

Composer 安装命令:

composer require gri3li/yii2-grid-file

包简介

This Yii2 extension provides ability to export data form data provider to format supported by PhpSpreadsheet

README 文档

README

This Yii2 extension provides ability to export data form instances of yii\data\DataProviderInterface to format supported by PhpSpreadsheet

Installation

Install the package via Composer:

composer require gri3li/yii2-grid-file

Usage

$export = new \gri3li\yii2gridfile\GridFile([
   'dataProvider' => new \yii\data\ArrayDataProvider([
       'allModels' => [
           [
               'name' => 'some name',
               'date' => 1538571363,
           ],
           [
               'name' => 'name 2',
               'date' => 1538571363,
           ],
       ],
   ]),
   'columns' => [
       'name',
       'date:datetime',
   ],
   'headerCellStyle' => [
       'font' => ['bold' => true],
       'fill' => [
           'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
           'startColor' => ['rgb' => 'CCCCCC'],
       ],
   ],
]);
$export->saveAs(\PhpOffice\PhpSpreadsheet\Writer\Xls::class, '/path/to/file.xls');

// $export->saveAs(\PhpOffice\PhpSpreadsheet\Writer\Xlsx::class, '/path/to/file.xlsx');
// $export->saveAs(\PhpOffice\PhpSpreadsheet\Writer\Ods::class, '/path/to/file.ods');
// $export->saveAs(\PhpOffice\PhpSpreadsheet\Writer\Html::class, '/path/to/file.html');
// $export->saveAs(\PhpOffice\PhpSpreadsheet\Writer\Csv::class, '/path/to/file.csv');

More info about phpspreadsheet style https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#styles

Use case https://github.com/gri3li/yii2-grid-file/tree/master/example

For run use case:

cd vendor/gri3li/yii2-grid-file/example/
php -S 127.0.0.1:8877

open http://127.0.0.1:8877

统计信息

  • 总下载量: 913
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-10-03