JS Library to create formatted XLSX spreadsheets

青春壹個敷衍的年華 提交于 2021-01-29 13:39:05

问题


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 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. The ability to add a picture (seen as a logo in the top-left)
  2. Ability to change font-color (as seen in the Title in the center)
  3. Ability to center-align text (as seen with the SubTitles in the center)
  4. Ability to make fields sortable (As seen with the arrow buttons per each column)

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.

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

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.

Thanks


回答1:


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.



来源:https://stackoverflow.com/questions/58963273/js-library-to-create-formatted-xlsx-spreadsheets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!