我有一个API,可以让我下载.pptx文件。因此,我正在编写一个内容类型为application/vnd.openxmlformats-officedocument.presentationml.presentation
且响应类型为文本的Http get请求。
但是我遇到JSON.parse()
的错误---因此,无法下载文件。
下面是参考代码:
service.ts:
getPPTs(){
const httpoptions = {
headers: new HttpHeaders({
'Content-Type': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',responseType : 'text',accept : 'application/vnd.openxmlformats-officedocument.presentationml.presentation',observe : 'response'
})
};
return this.http.get(environment.resourceUrl,httpoptions);
}
我还想在模式弹出窗口中显示.pptx
文件内容。
有人可以提出任何解决方案吗?