JS库创建格式化的XLSX电子表格 [英] JS Library to create formatted XLSX spreadsheets

查看:81
本文介绍了JS库创建格式化的XLSX电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 https://www.npmjs.com/package在JS中创建通用电子表格/xlsx .这样可以很好地生成仅通用的电子表格来显示我的数据.但是,我想添加一些功能.

I'm currently creating generic spreadsheets in JS using https://www.npmjs.com/package/xlsx . This works fine to generate just a generic spreadsheet to display my data. However, I wanna add a few features.

https://imgur.com/a/gJE9mXg 是我想要的示例达到.它是使用Apache POI创建的,仅适用于Java.

https://imgur.com/a/gJE9mXg is an example of what I want to achieve. It was created using Apache POI, which is only available for Java.

该屏幕截图中我想要的功能是

The features I want in that screenshot are

  1. 添加图片的能力(在左上角显示为徽标)
  2. 更改字体颜色的能力(如中间标题中所示)
  3. 使文本居中对齐的能力(如居中的字幕所示)
  4. 使字段可排序的能力(如每列的箭头按钮所示)

似乎SheetJS可以通过其高级版本提供某些此功能. https://dzone.com/articles/5-popular-standalone-javascript-spreadhsheet-libra 是我研究过的其他库的列表.但是,该列表似乎更多是模拟具有本地JS对象的电子表格,而不是创建.xlsx文件.另外,其中大多数都需要付费许可证.

Seems like SheetJS can provide some of this functionality through their premium version. https://dzone.com/articles/5-popular-standalone-javascript-spreadhsheet-libra is a list of other libraries I looked into. However, that list seems more of emulating a spreadsheet with native JS objects as opposed to creating an .xlsx file. Also, most of them require paid licenses.

有人有使用免费的JS解决方案创建我的4个需求的经验吗?我正在构建Meteor JS btw.

Anybody have experience with creating my 4 requirements with a free JS solution? I'm building on Meteor JS btw.

如果没有,是否还有其他解决方法可以实现?IE.让应用程序仅输出一个.csv,然后创建一个通用的excel模板"文件,该文件将使用csv进行所有格式设置?或者,委派其他一些程序/脚本来生成XLSX并下载输出文件.

If not, are there any other workarounds to achieving this? I.e. Having the app just output a .csv, but then creating a generic excel "template" file which will do all the formatting with the csv? Or, delegating to some other program/script to generate the XLSX and downloading the output file.

谢谢

推荐答案

exceljs 具有您所拥有的所有功能想要的是,它的API略有不同,并且不如 xlsx 受欢迎,这就是为什么它总是在雷达下飞速发展的原因.

exceljs got all the features you want, it's just got a slightly different API and not as popular as xlsx that's why it always flies under the radar.

这篇关于JS库创建格式化的XLSX电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆