我的客户只需要查看 Office 查看器(doc、docx、ppt 等..)。我尝试在java中将文档转换为PDF(使用apache poi和doc4j)并使用pdf查看器显示它。但是结果不太完美。转换后的pdf文件不能像文档中那样正确渲染图像和表格。所以我想到在线使用 Microsoft Office 查看器并隐藏提供下载按钮和打印按钮的状态栏,从而使其只能查看。但我无法访问 iframe 内的 dom 元素。有没有更好的方法来处理这个问题或建议任何解决方案将 Office 文件转换为 pdf 或任何图像格式。
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=https://calibre-ebook.com/downloads/demos/demo.docx' width='1366px' height='623px' frameborder='0'></iframe>
这是在 html 中嵌入 live Office 查看器的代码。
我也尝试过
<iframe id='resViewer' src='https://docs.google.com/viewer?url=https://calibre-ebook.com/downloads/demos/demo.docx&embedded=true' style='width: 700px; height: 700px;' frameborder='0'></iframe>
在这种情况下,我无法隐藏弹出按钮。我在堆栈溢出本身中引用了许多帖子,但这些帖子都不适合我。
最佳答案
你为什么不试试这个hide popout
div[aria-label="Pop-out"] {
display: none;
}
//syntax
div[aria-label="toolbar"] {
width: 52px;
}
关于javascript - 如何隐藏 Microsoft Office Online Viewer 中的状态栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41115141/