npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hlt-export-excel

v1.0.2

Published

json export excel

Downloads

3

Readme

hlt-export-excel

纯 js 导出 excel

下载

npm install hlt-export-excel

or

yarn add hlt-export-excel

文档

用法

    const ExportJsonExcel = require('hlt-export-excel')

    var option={};

    option.fileName = 'excel'
    option.datas=[
      {
        sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}],
        sheetName:'sheet',
        sheetFilter:['two','one'],
        sheetHeader:['第一列','第二列'],
        columnWidths: [20, 20]
      },
      {
        sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}]
      }
    ];

    var toExcel = new ExportJsonExcel(option); //new
    toExcel.saveExcel(); //保存

option

1.datas 数据

   /*多个sheet*/
   /*每个sheet为一个object */
   [{
   sheetData:[], // 数据
   sheetName:'', // sheet名字
   sheetFilter:[], //列过滤
   sheetHeader:[] // 第一行
   columnWidths: [] //列宽 需与列顺序对应
   }]

2.fileName 下载文件名(默认:download)

sheet option

1.sheetName sheet 名字(可有可无)(默认 sheet1) 2.sheetHeader 标题(excel 第一行数据)

    sheetHeader: ["第一列", "第二列"];

3.columnWidths 列宽 非必须

    columnWidths = [20, ""];

4.sheetData 数据源(必须)

    <!--两种形式-->
    <!--第一种 object-->
    [{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}]
    <!--第二种 arrary-->
    [['一行一列','一行二列'],['二行一列','二行二列']]

5.sheetFilter 列过滤(只有在 data 为 object 下起作用)(可有可无)

    sheetFilter = ["two", "one"];