I\'ve an API which returns an excel document as response. The request will be one simple json.
I\'ve searched google and found some code base to download the file and I
You need to set the response-header { responseType: 'blob'}
in the request.
You need to pass in the correct MIME-Type as you'are creating the blob-file. (f.e. application/octet-stream or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet).
component.ts
downloadFile(data: Response) {
const blob = new Blob([data], { type: 'application/octet-stream' });
const url= window.URL.createObjectURL(blob);
window.open(url);
}