找回密码
 立即注册

QQ登录

只需一步,快速开始

pioneer_web

注册会员

2

主题

8

帖子

89

积分

注册会员

积分
89
最新发帖
pioneer_web
注册会员   /  发表于:2021-1-18 10:16  /   查看:2028  /  回复:5
本帖最后由 pioneer_web 于 2021-1-18 10:18 编辑
  1. <div class="file-area">
  2.             <span class="upload" @change="importExcel($event)" v-if="isView == true">导入<input type="file" class="elchange" /></span>
  3.             <el-button type="primary" @click="exportExcel()">导出</el-button>
  4.         </div>
  5.         <gc-spread-sheets class='spreadHost' @workbookInitialized="initSpread($event)" ref="spreadBosh">
  6.             <gc-worksheet></gc-worksheet>
  7.         </gc-spread-sheets>
复制代码
  1. //导入
  2.         importExcel(event) {
  3.             const file = event.target.files[0];
  4.             this.fileName = file.name;
  5.             let self = this;
  6.             if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
  7.                 this.$message.error('导入文件格式有误');
  8.             }
  9.             let excelIO = new ExcelIO.IO();
  10.             excelIO.open(file, (spreadJSON) => {
  11.                 if (self.spread) {
  12.                     self.spread.fromJSON(spreadJSON);
  13.                 }
  14.             });
  15.             console.log(excelIO, 'excelIO')
  16.         },
  17.         //导出
  18.         exportExcel() {
  19.             let self = this;
  20.             if (self.spread) {
  21.                 let spreadJSON = JSON.stringify(self.spread.toJSON());
  22.                 let excelIO = new ExcelIO.IO();
  23.                 excelIO.save(spreadJSON, (blob)=>{
  24.                     FileSaver.saveAs(blob, this.fileName + ".xlsx");
  25.                 })
  26.             }
  27.         },
复制代码


0.png
微信截图_20210118101536.png

5 个回复

倒序浏览
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-1-18 10:47:11
沙发
您好,出现Evaluation Version这个表单是因为您的项目中没有授权,添加授权后,导入导出就不会有此表单。
回复 使用道具 举报
pioneer_web
注册会员   /  发表于:2021-1-20 09:53:16
板凳
DerrickJiao 发表于 2021-1-18 10:47
您好,出现Evaluation Version这个表单是因为您的项目中没有授权,添加授权后,导入导出就不会有此表单。

添加了授权码后,本地可以正常导入导出,部署线上 还是会显示License Not Found
0.png
1.png
回复 使用道具 举报
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-1-20 10:58:16
地板
pioneer_web 发表于 2021-1-20 09:53
添加了授权码后,本地可以正常导入导出,部署线上 还是会显示License Not Found

您看下您的Excel是否有这个sheet页,有的话麻烦您将Excel中的删除后再重新导入导出
回复 使用道具 举报
柠檬汽水
初级会员   /  发表于:2021-1-22 14:25:23
5#
DerrickJiao 发表于 2021-1-20 10:58
您看下您的Excel是否有这个sheet页,有的话麻烦您将Excel中的删除后再重新导入导出

好的,感谢
回复 使用道具 举报
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-1-22 14:28:56
6#

不用客气的
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部