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

egg-szjcomo-excel

v1.0.5

Published

egg szjcomo excel

Downloads

4

Readme

egg-szjcomo-excel

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-szjcomo-excel --save

Usage

// {app_root}/config/plugin.js
exports.excel = {
  enable: true,
  package: 'egg-szjcomo-excel',
};

Configuration

// {app_root}/config/config.default.js
exports.excel = {
};

see config/config.default.js for more detail.

Example

读取excel表格

read方法

read function(filename,options = {},index_sheet = 0)

| 参数名称 | 类型 | 是否必须 | 备注 | | ------------ | ------------ | ------------ | ------------ | | filename | string | 是 | -(表格名称,只能为xlsx格式的表格文件) | | options | object | 否 | - {fields:[],skip:0} | | index_sheet | int | 否 | - 读取表格里面的第几张表 default:0 |

用法示例

const headers = ['school_name','password','','admin_id'];
console.log(app.excel.read('test.xlsx',{fileds:headers,skip:0},0));

特列说明

options.fields 为列参应的字典下标 options.skip 为需要跳过的行


写入excel表格

write方法

write function(data,filename,headers = [],options = {},cusTitle = [])

| 参数名称 | 类型 | 是否必须 | 备注 | | ------------ | ------------ | ------------ | ------------ | | data | array | 是 | -写入数据 | | filename | string | 是 | - (表格名称,只能为xlsx格式的表格文件) | | headers | array | 是 | - 表头自动生成 | | options | object | 否 | - 参见 node-xlsx参数 | | cusTitle | array | 否 | - 不需要自动生成,手动自定义 |

简单用法

	let data = [{name:'szjcomo',idcardno:'123456'}];
	let headers = [{name:'用户名',key:'name'},{name:'身份证号',key:'idcardno'}];
	app.excel.write(data,'test.xlsx',headers)

复杂用法

let data = [{name:'szjcomo',idcardno:'123456',id:1}];
let headers = [{name:'序号',key:'id'},{name:'用户名',key:'name'},{name:'身份证号',key:'idcardno'}];
let cusTitle = [['序号','详细信息'],['','用户名','身份证号']];
let options = {'!merges':[{s:{c:0,r:0},e:{c:0,r:1}},{s:{c:1,r:0},e:{c:2,r:0}}]};
app.excel.write(data,'test.xlsx',headers,options,cusTitle)

Questions & Suggestions

Please open an issue here.

License

MIT