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 🙏

© 2025 – Pkg Stats / Ryan Hefner

export-to-exceljs-util

v1.1.0

Published

使用exceljs导出excel文件

Downloads

43

Readme

export-to-exceljs-util

简介

export-to-exceljs-util 是一个基于 exceljs 的前端库,用于实现多表头的 Excel 文件导出功能。

安装指南

安装命令

您可以通过 npm 或 yarn 来安装export-to-exceljs-util

使用 npm 安装:

npm i export-to-exceljs-util

使用 yarn 安装:

yarn add export-to-exceljs-util

代码示例

import ExcelExporter from "export-to-exceljs-util";

// 列数据
const columns = [
  {
    title: "姓名",
    children: [
      {
        title: "姓",
        key: "first_name",
      },
      {
        title: "名",
        key: "last_name",
      },
    ],
  },
  {
    title: "年龄",
    key: "age",
  },
  {
    title: "地址",
    key: "address",
  },
];

// 数据列表
const data = [
  {
    name: "张三",
    age: 25,
    address: "北京市",
  },
];

// 文件名称
const fileName = "测试数据.xlsx";

// 其他信息(可选)
const otherInfo = '注释:这里是一些其他信息';

// 创建 Excel 导出实例
const excelExporter = new ExcelExporter(columns, data, fileName, otherInfo);

// 执行导出操作
excelExporter.exportToExcel();

注意事项

  • data 数组的每一项必须包含与 columns 数组中相同的 key。
  • 当时数据量大于1w行时,工具类ExcelExporter参数属性必须是可被复制的,比如示例中的columns,data中的属性都是简单的数字、字符串、布尔值等,如使用vue3的ref声明的对象,需要使用toRaw()方法转换为普通对象,否则会报错。
  • 此工具类未压缩代码,需要自定义样式的开发者可以自提代码进行修改。