this.httpClient.post(url1, JSON.parse(data1) , {responseType: 'blob'}).subscribe(data => {
            const link = document.createElement('a');
            const blob = new Blob([data], {type: 'application/vnd.ms-excel'});
            link.setAttribute('href', window.URL.createObjectURL(blob));
            link.setAttribute('download', 'Inventory' + new Date().getTime() + '.xls');
            link.style.visibility = 'hidden';
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        });
    }
View Code

 

posted on 2018-10-18 13:46  lshan  阅读(137)  评论(0编辑  收藏  举报