spreadjs版本: 13.1.0
前端加载excel代码如下:
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById("container"), {calcOnDemand : true});
- var excelIo = new GC.Spread.Excel.IO();
- excelIo.open(file, function (json) {
- spread.suspendPaint();
- var workbookObj = json;
- spread.fromJSON(workbookObj);
- spread.resumePaint();
- }, function (e) {
- if(e.errorCode == "1"){
- alert("The imported file is not a valid Microsoft Excel document, or is not saved in a supported format.");
- }
复制代码 页面上可以显示excel内容,但超链接不生效
但是在后台中使用gcexcel框架(版本:3.1.0),读取excel转换成json,再在前端加载,超链接是生效的
- Workbook workBook = new Workbook();
- workBook.open(is);//从服务器上读取excel转换成io流
- workBook.toJson();//转换成json,在前端渲染
复制代码 上述2种方式使用的是同一个文件
用户有可能直接导入Excel,也有可能将Excel上传到服务器作为模板,新建时使用这个模板作为SpreadJS的初始化内容
如果前端和后端的行为不一致,会造成用户困惑
2种方式生成的json信息,我都查看过,使用前端API转换的json内容,超链接确实是丢失了,后端API导入的是存在的
前端导入,超链接丢失
后端导入,超链接保留
请问这是什么原因呢?
|
|