我在Angular JS中创建了一个应用程序,用于通过$ http帖子下载Excel工作簿.
在下面的代码中,我以JSON的形式传递信息,并通过角度$ http帖子将其发送到服务器REST Web服务(java).Web服务使用JSON中的信息并生成Excel工作簿.在$ http post的成功主体内的响应中,我在该数据变量中获取二进制数据,但不知道如何转换它并下载为Excel文件.
谁能告诉我一些解决方案,将二进制文件转换为Excel文件并下载?
我的代码如下:
$http({
url: 'myweb.com/myrestService',
method: "POST",
data: json, //this is your json data string
headers: {
'Content-type': 'application/json'
}
}).success(function (data, status, headers, config) {
// Here i'm getting excel sheet binary datas in 'data'
}).error(function (data, status, headers, config) {
});
Run Code Online (Sandbox Code Playgroud) XlsxWriter对象保存为http响应以在Django中创建下载?