websix / xlsx-compiler
目标是简单、快速、直接到点的 Xlsx 编译器
1.1.3
2015-05-13 14:41 UTC
Requires (Dev)
- phpunit/phpunit: ~4.6
README
接受以下格式的 JSON
{ "Sheet name": [ {"A": "A1 Value", "B": "B1 Value"}, // Row ... ], ... "Last sheet name": [ {"A": "A1 Value", "B": "B1 Value"} // Row ], "maxCols": 2 // Max number of columns to be presented in the sheet }
并将其转换为 .xlsx 文件。
用法
安装包
composer require websix/xlsx-compiler
在您的脚本中使用 XlsxCompiler 类
<?php ... uses Websix\XlsxCompiler\XlsxCompiler; ... $compiler = new XlsxCompiler(); // Generate $json in the shown format before $xlsx = $compiler->compileJson($json); // In $xlsx you have the fileblob tha you can save into a .xlsx file or echo in // the output for browser download
API
命名空间:Websix\XlsxCompiler;
类名:XlsxCompiler
#compileJson($json) -> blob
传入 $json,格式如上所述的 JSON,结果将是 xlsx blob