【问题标题】:How to get JSON data as RTF format in Angular2如何在Angular2中以RTF格式获取JSON数据
【发布时间】:2018-07-03 14:32:43
【问题描述】:

我正在尝试以 ANGULAR2 格式处理来自 API 服务的 JSON 数据。

我不知道该写什么。 这是一个示例代码

return this.http.get(url,{responseType: ResponseContentType.Blob }).map(
    (res) => {
        return new Blob([res.blob()], { type: 'application/vnd.ms-excel' })
    })

此代码适用于 Excel 格式。 我想要 RTF 格式。 应用程序类型是什么?

【问题讨论】:

  • json 数据以rtf 处理为vnd.ms-excel?
  • 字节流数据到 RTF

标签: angularjs angular angular2-services angular2-directives


【解决方案1】:

您应该将 Content-Type 设置为

this.http.get(url,{
                headers : new Headers(('Content-Type', 'application/vnd.ms-excel'),
                responseType: ResponseContentType.Blob }).map(
    (res) => {
        return new Blob([res.blob()], { type: 'application/vnd.ms-excel' })
    })

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-31
  • 1970-01-01
  • 1970-01-01
  • 2016-05-01
  • 2020-11-24
相关资源
最近更新 更多