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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@liuyi_npm/excel

v1.0.8

Published

## 1.基础使用

Downloads

13

Readme

@liuyi_npm/excel

1.基础使用

首先安装 xlsx-js-style file-saver

yarn add @liuyi_npm/excel

2.使用case

	const header = [
		{
			label: '统计表',
			style: {
				// 为第一行合并的表头设置样式
				alignment: { horizontal: 'center', vertical: 'center' },
				font: { bold: true, sz: 16, color: { rgb: 'FF0000' } }, // 字体加粗,大小16,红色
				fill: { fgColor: { rgb: 'FFFF00' } } // 背景色黄色
			},
			children: [
				{
					label: '**',
					prop: 'makeTime',
					style: { alignment: { horizontal: 'left' } }
				}, // 左对齐
				{ label: '**', prop: 'voucherNo' },
				{ label: '**', prop: 'settlementObjectValue' },
				{ label: '**', prop: 'remark' },
				{ label: '**', prop: 'shareName' },
				{ label: '**', prop: 'bizType' },
				{ label: '**', prop: 'subjectName' },
				{
					label: '**',
					prop: 'borrowPrice',
					style: { font: { color: { rgb: '008000' } } }
				}, // 绿色字体
				{
					label: '**',
					prop: 'creditPrice',
					style: { font: { bold: true } }
				} // 加粗
			]
		}
	]
	const data = this.dataList.map(item => ({
		makeTime: item.makeTime,
		voucherNo: `记-${item.voucherNo}`,
		settlementObjectValue: item.settlementObjectValue,
		remark: item.remark,
		shareName: item.shareName,
		bizType: this.filterBizTypesMap[item.bizType],
		subjectName: item.subjectName,
		borrowPrice: item.borrowPrice,
		creditPrice: item.creditPrice
	}))
	exportExcel({
		header, // 表头以及列渲染的定义
		data, // 数据
		filename: '数据记录' // 导出文件名
	})

3.配置项

| 参数名 | 含义 | 备注 | | --------- | -------------- | ---------------------- | | options | 导出配置选项 | 具体可配置参数,见下表 | | options.header | 表头数组,包含列名和样式配置 | 具体可配置参数,见下表 | | options.data | 数据数组,包含要导出的数据 | 具体可配置参数,见下表 | | options.filename | 导出的 Excel 文件名 | 具体可配置参数,见下表 | | options.sheetName | 工作表名称,默认为 Sheet1 | 具体可配置参数,见下表 | | options.autoWidth | 是否自动调整列宽,默认为 true | 具体可配置参数,见下表 | | options.watermark | 水印文本,默认为空字符串 | 暂不支持,后续会支持文本、图片水印 |