websix/xlsx-compiler

目标是简单、快速、直接到点的 Xlsx 编译器

安装: 28

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 0

开放问题: 0

语言:JavaScript

1.1.3 2015-05-13 14:41 UTC

This package is auto-updated.

Last update: 2024-09-21 19:41:44 UTC


README

Build Status

接受以下格式的 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