相关疑难解决方法(0)

AngularJS $ http-post - 将二进制文件转换为excel文件并下载

我在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)

excel json http-post angularjs

52
推荐指数
4
解决办法
13万
查看次数

35
推荐指数
3
解决办法
2万
查看次数

标签 统计

excel ×2

angularjs ×1

django ×1

http-post ×1

httpresponse ×1

json ×1

python ×1

xlsxwriter ×1