在 IE 7 中使用 JavaScript 将 Base64 字符串保存为 Excel .xls 文件
我一直在尝试找到一种在 IE 7 中使用 JavaScript 将 Base64 字符串保存为 Excel .xls 文件的方法。以下内容适用于 FireFox:
window.open ("data:application/vnd.ms-excel;base64," + bytestring, "", "width=300,height=300,resizable=1");
其中 bytestring 是 Base64 字符串。然而,这种方法不适用于 IE 7。
经过一些互联网研究,IE 7 似乎无法处理 Base64 字符串。我怎样才能实现这一目标?我是否必须使用将 Base64 转换为 UTF 才能执行此操作?
我想要实现的是,当用户单击按钮时,会出现“另存为”对话框,允许用户提供文件名并选择目标位置,然后保存 Excel 文件。
我仅限于使用 IE 7。相信我,如果我可以选择使用其他浏览器,我一定会的。
预先感谢您的任何帮助!
I have been trying to find a way to save a Base64 String in IE 7 using JavaScript as a Excel .xls file. The following works fine with FireFox:
window.open ("data:application/vnd.ms-excel;base64," + bytestring, "", "width=300,height=300,resizable=1");
where bytestring is the Base64 string. This method however does not work for IE 7.
Having done some internet research, it seems that IE 7 can't seem to handle dealing with Base64 Strings. How would I be able to achieve this? Would I have to use convert Base64 to UTF to be able to do this?
What I am trying to achieve is when the user clicks a button, the 'save as' dialog appears, allowing the user to give a filename and select destination, and then saving the Excel file.
I am limited to using IE 7. Believe me, if I had a choice to use a different browser, I definitely would.
Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有服务器端代理,这在 IE7 中是不可能的。要么执行此操作,要么输出 HTML 表格并要求用户将其复制并粘贴到 Excel 中。
This isn't possible in IE7, without a server-side proxy. Either do that, or output an HTML table and ask the user to copy and paste it into Excel.