如何在 reactjs 中的 iFrame 中渲染 xlsx?
How to render xlsx inside iFrame in reactjs?
我们可以在 html 中渲染 xlsx 文件吗?
应该兼容IE和chrome等浏览器。
<iframe
height="500px"
width="100%"
src={file.url}
/>
但是在页面加载后,这实际上是在下载文件。
Excel 或 .xlsx 扩展文件不会在 browser/iframes.
中原生显示
最接近的是拥有一个读取 Excel 文件然后根据其内容生成 HTML 的库。
或
另一个解决方案是将文件转换为 pdf 并将其显示在 iframe 中。
我用这个 API 做到了:
https://view.officeapps.live.com/op/embed.aspx?src=http://www.learningaboutelectronics.com/Articles/Example.xlsx
将此插入到 iframe 中,您将能够看到 excel。
我们可以在 html 中渲染 xlsx 文件吗?
应该兼容IE和chrome等浏览器。
<iframe
height="500px"
width="100%"
src={file.url}
/>
但是在页面加载后,这实际上是在下载文件。
Excel 或 .xlsx 扩展文件不会在 browser/iframes.
中原生显示最接近的是拥有一个读取 Excel 文件然后根据其内容生成 HTML 的库。
或
另一个解决方案是将文件转换为 pdf 并将其显示在 iframe 中。
我用这个 API 做到了:
https://view.officeapps.live.com/op/embed.aspx?src=http://www.learningaboutelectronics.com/Articles/Example.xlsx
将此插入到 iframe 中,您将能够看到 excel。