gpt4 book ai didi

angularjs - 使用angular在html中显示ms word文件

转载 作者:搜寻专家 更新时间:2023-10-31 08:05:49 26 4
gpt4 key购买 nike

如何使用 Angular 或 JavaScript 在 HTML 页面中显示 Microsoft Word 文件。请推荐任何提供此功能的库。

最佳答案

No browsers currently have the code necessary to render Word Documents, and as far as I know, there are no client-side libraries that currently exist for rendering them either

However, if you only need to display the Word Document, but don't need to edit it, you can use Google Documents' Viewer via an to display a remotely hosted .doc/.docx.

<iframe src="http://docs.google.com/gview?url=http://remote.url.tld/path/to/document.doc&embedded=true"></iframe>

示例: jsfidle

但是,如果您希望获得原生支持,在大多数(如果不是所有)浏览器中,我建议将 .doc/.docx 重新保存为 PDF 文件那些也可以独立呈现使用 Mozilla 的 PDF.js。

编辑:

非常感谢 fatbotdesigns 在评论中发布 Microsoft Office 365 查看器。

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http://remote.url.tld/path/to/document.doc' width='1366px' height='623px' frameborder='0'>This is an embedded <a target='_blank' href='http://office.com'>Microsoft Office</a> document, powered by <a target='_blank' href='http://office.com/webapps'>Office Online</a>.</iframe>

实例:

Google Docs Viewer

Microsoft Office Viewer

关于angularjs - 使用angular在html中显示ms word文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35981094/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com