文章目录
- 使用
项目地址;link
使用
一个最简单的demo,只用一个html,不需要任何其它配置
1 2 3 4 5 6 7 8 9 10 11 | <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/xspreadsheet.css"> <script src="//i2.wp.com/unpkg.com/[email protected]/dist/xspreadsheet.js"></script> <script src="//i2.wp.com/unpkg.com/[email protected]/dist/locale/zh-cn.js"></script> <div id="x-spreadsheet-demo"> <script> x_spreadsheet.locale('zh-cn'); //中文 var htmlout = document.getElementById('x-spreadsheet-demo') var xs = x_spreadsheet(htmlout </script> </body> </div> |
现在的问题是如何把插件加载json数据,以及处理保存的问题。数据导出成excel应该没问题。
在npm中使用
作者说不推荐,放弃
导入和导出
作者给的例子是另一个项目里的:link
这个例子下载后在win上有bug:
- index.html第45,46行,引用的两个文件是链接,在win是不生效的,手动下载这两个文件
- index.html 第55行,var xspr = x.spreadsheet(HTMLOUT),变量x未定义,改成x_spreadsheet(HTMLOUT)
改了之后就,浏览器打开index.html后就可以使用了,效果还不错。导出之后会丢失所有格式。