有没有办法通过office在angular和view中嵌入ppt?

有没有办法通过office在angular和view中嵌入ppt?,angular,Angular,我正在尝试使用以下代码打开angular中的ppt <iframe src='https://view.officeapps.live.com/op/embed.aspx?src={urlencode(url)}' width='962px' height='565px' frameborder='0'></iframe> 但是我得到了一个错误页面 要解决此问题,您需要使用DomSanitizer,SafeSourceURL:- 您需要使用typescript文

我正在尝试使用以下代码打开angular中的ppt

<iframe
  src='https://view.officeapps.live.com/op/embed.aspx?src={urlencode(url)}'
  width='962px' height='565px' frameborder='0'></iframe>
但是我得到了一个错误页面

要解决此问题,您需要使用DomSanitizer,SafeSourceURL:-

您需要使用typescript文件中定义的SafeSourceUrl类型的变量绑定iframe的源

然后使用sanitizer实例,您需要绕过SecurityTrustURL

url:SafeResourceUrl;
constructor(private sanitizer: DomSanitizer){
  const baseUrl = 'https://example.com';
  this.url = this.sanitizer.bypassSecurityTrustResourceUrl(baseUrl);
}

我甚至使用过ngx文档查看器,但结果是一样的。我可以用gview做这件事,但我必须用office@AManoj您是否尝试过在浏览器选项卡中打开此特定url?如果你没有,那么你应该试试看它是否打开。如果它仍然没有打开,那么很可能是与您试图打开的url相关的问题。