downloading xlsx file in angular 2 with blob

前端 未结 6 743
悲&欢浪女
悲&欢浪女 2021-01-02 02:31

I want to download xlsx file from the client on angular 2 using rest api.

I\'m getting a byte array as a response from my GET request and I\'m sending it to download

6条回答
  •  情话喂你
    2021-01-02 03:08

    you can use the below code :

    var file = new Blob([data], { 
        type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' 
    });
    saveAs(file,"nameFile"+".xlsx");
    deferred.resolve(data);
    

提交回复
热议问题