如何使用JavaScript导出Excel文件? [英] How can I export Excel files using JavaScript?

查看:44
本文介绍了如何使用JavaScript导出Excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以通过Javascript生成Excel/CSV?(它也应该与浏览器兼容)

Is there any way to generate Excel/CSV through Javascript? (It should be browser compaatible too)

推荐答案

在github上有一个有趣的项目,名为 Excel Builder(.js)提供了一种下载Excel xlsx 文件的客户端方法,并提供了格式化Excel电子表格的选项.
https://github.com/stephenliberty/excel-builder.js

There is an interesting project on github called Excel Builder (.js) that offers a client-side way of downloading Excel xlsx files and includes options for formatting the Excel spreadsheet.
https://github.com/stephenliberty/excel-builder.js

使用此库可能会遇到浏览器和Excel兼容性问题,但是在正确的条件下,它可能会非常有用.

You may encounter both browser and Excel compatibility issues using this library, but under the right conditions, it may be quite useful.

另一个GitHub项目,其Excel选项较少,但对Excel兼容性问题的担心较少,可以在这里找到: ExcellentExport.js
https://github.com/jmaister/excellentexport

Another github project with less Excel options but less worries about Excel compatibility issues can be found here: ExcellentExport.js
https://github.com/jmaister/excellentexport

如果您使用的是AngularJS,则有 ng-csv :
将数组和对象转换为可下载CSV文件的简单指令".

If you are using AngularJS, there is ng-csv:
a "Simple directive that turns arrays and objects into downloadable CSV files".

这篇关于如何使用JavaScript导出Excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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