在Excel Angularjs中保存json数组
如何将从后端返回的Json数组保存到Angularjs中的Excel文件中 这是连接到后端的查询。它应该返回一个Excel文件,但不知何故它返回了一个Json数组 curl-o orders.xlsx-标题授权:xxxxxxx-标题应用程序/vnd.openxmlformats-officedocument.spreadsheetml.sheet 我找到了这个样本,但它并不完全符合我的需要。特别是,它将Json转换为字符串,Json不是数组 如果我把前三行改成在Excel Angularjs中保存json数组,json,angularjs,filesaver.js,Json,Angularjs,Filesaver.js,如何将从后端返回的Json数组保存到Angularjs中的Excel文件中 这是连接到后端的查询。它应该返回一个Excel文件,但不知何故它返回了一个Json数组 curl-o orders.xlsx-标题授权:xxxxxxx-标题应用程序/vnd.openxmlformats-officedocument.spreadsheetml.sheet 我找到了这个样本,但它并不完全符合我的需要。特别是,它将Json转换为字符串,Json不是数组 如果我把前三行改成 var data = [{a:1}
var data = [{a:1}, {b:2}, {c:3}];
var blob = new Blob([data], {type: "application/json"});
输出内容为:
[object Object],[object Object],[object Object]
我想使用FileSaver.js,这可能会有所帮助。有什么建议吗?看看这个