我已經(jīng)在Angular JS中創(chuàng)建了一個(gè)應(yīng)用程序,用于通過(guò)$ http發(fā)布下載Excel工作簿。在下面的代碼中,我以JSON的形式傳遞信息,并通過(guò)有角的$ http帖子將其發(fā)送到服務(wù)器REST Web服務(wù)(java)。該Web服務(wù)使用JSON中的信息,并生成一個(gè)Excel工作簿。在$ http post成功正文內(nèi)的響應(yīng)中,我在該數(shù)據(jù)變量中獲取了二進(jìn)制數(shù)據(jù),但不知道如何將其轉(zhuǎn)換并下載為Excel文件。有人可以告訴我一些將二進(jìn)制文件轉(zhuǎn)換為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) { });
AngularJS $ http-post-將二進(jìn)制文件轉(zhuǎn)換為Excel文件并下載
小怪獸愛(ài)吃肉
2019-11-11 15:04:31