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

export-x-to-excel

v0.2.1

Published

The front-end implementation of exporting a table to an Excel file.

Downloads

1

Readme

export-to-excel

前端实现将表格导出成 Excel 文件。

使用场景

将页面上指定 <Table> 导出为 Excel 文件

import { export_table_to_excel } from 'export-x-to-excel';

const tableElement = document.querySelector('#table');
const fileName = 'test.xlsx';
export_table_to_excel(tableElement, fileName);

将数据导入到 Excel 文件

import { export_data_to_excel } from 'export-x-to-excel';

const th = ['name', 'age', 'position'];
const tData = [
  ['Zhang sang', 28, 'Manager'],
  ['Li si', 29, 'Engineer'],
  ['Wang wu', 24, 'Designer'],
  ['Zhao liu', 25, 'Programmer'],
  ['Chen qi', 23, 'Tester'],
];
const fileName = 'test.xlsx';
export_data_to_excel(th, tData, fileName);

将多个表格数据拼接输出

import { generate_table_array, export_table_array_to_excel } from 'export-x-to-excel';

// 适用于部分UI框架表格,表格元素主体不连贯,如: `view-design`
const table01Data = generate_table_array(document.querySelector('#table-01'));
const table02Data = generate_table_array(document.querySelector('#table-02'));

export_table_array_to_excel([table01Data[0], [table01Data[1].concat(table02Data[1])]], 'test.xlsx');