excel-export-demo

0.0.1 • Public • Published

shoots-plugin-xlsx-export

用法

可用于router下或lambda下

lambda用法

function getData(worksheet, workbook, resp) {
    return new Promise((res, rej) => {
        setTimeout(() => {
            res(null)
        }, 10000)
    })
}
let shootsExport = require('shoots-plugin-xlsx-export')
module.exports = async function (params, ctx, next) {
    let ins = new shootsExport(ctx, {
        fileName: '导出的文件名',
        sheetName: "defaultsheet",
        columns: [{
            header: '标题',
            key: 'Title',
            width: 10
        }, {
            header: '标题1',
            key: 'Title1',
            width: 10
        }, {
            header: '标题2',
            key: 'Title2',
            width: 10
        }]
    })
    ctx.succeed(ins.start())
    let data = getData().then(() => {
        ins.addRow({
            Title1: 'Title1',
            Title2: 'Title1',
            Title: 'Title1'
        })
        ins.addRow({
            Title1: 'Title1_line2',
            Title2: 'Title1_line2',
            Title: 'Title1_line2'
        })
        ins.build()
    })
}

Readme

Keywords

none

Package Sidebar

Install

npm i excel-export-demo

Weekly Downloads

2

Version

0.0.1

License

GPL-3.0

Unpacked Size

15 kB

Total Files

14

Last publish

Collaborators

  • luzaiquan