定制 vielhuber/excelhelper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vielhuber/excelhelper

最新稳定版本:1.2.5

Composer 安装命令:

composer require vielhuber/excelhelper

包简介

A super simple excel wrapper in php.

README 文档

README

build status

📗 excelhelper 📗

excelhelper is a helper for excel.

with its help you can write and read to xlsx/xls/csv in php in a very simple, webdev-friendly way. it also handles issues with big numbers and other quirks.

installation

install once with composer:

composer require vielhuber/excelhelper

then add this to your files:

require __DIR__ . '/vendor/autoload.php';
use vielhuber\excelhelper\excelhelper;

usage

reading

$array = excelhelper::read([
    'file' => 'file.xlsx',
    'first_line' => true, // true|false
    'format_cells' => false, // false|true
    'all_sheets' => false, // false|true
    'friendly_keys' => false // false|true
    'titles_as_keys' => false // false|true
]);

writing

excelhelper::write([
    'file' => 'file.xlsx', // can write xlsx, xls and csv; if null, a filename is suggested
    'engine' => 'phpspreadsheet',
    'output' => 'save', // save|download
    'style_header' => true, // true|false
    'autosize_columns' => true, // true|false
    'auto_borders' => true, // true|false
    'remove_empty_cols' => false, // true|false
    'data' => [
        ['a1', 'b1', 'c1'],
        ['a2', 'b2', 'c2'],
        [
            [
                'value' => 'a3',
                'background-color' => '#ff0000',
                'color' => '#ffffff',
                'font-weight' => 'bold',
                'border' => '1px solid #000',
                'text-align' => 'center'
            ],
            [
                'value' => 'b3',
                'background-color' => '#ff0000',
                'color' => '#ffffff',
                'font-weight' => 'bold',
                'border' => '1px solid #000',
                'text-align' => 'left'
            ],
            [
                'value' => 'c3',
                'background-color' => '#ff0000',
                'color' => '#ffffff',
                'font-weight' => 'bold',
                'border' => '1px solid #000',
                'text-align' => 'right'
            ]
        ]
    ]
]);
excelhelper::write([
    'file' => 'file.xlsx',
    'engine' => 'phpspreadsheet',
    'output' => 'save',
    'data' => [
        'Sheet 1' => [['a1', 'b1', 'c1'], ['a2', 'b2', 'c2']],
        'Sheet 2' => [['a1', 'b1', 'c1'], ['a2', 'b2', 'c2']],
        'Sheet 3' => [['a1', 'b1', 'c1'], ['a2', 'b2', 'c2']]
    ]
]);

统计信息

  • 总下载量: 1.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-11