如何将 mht 从流/字符串加载到 WebBrowser 控件中?
如果我使用 Navigate
方法,WebBrowser 控件会正确加载任何 mht
文件,但当我使用 DocumentText
或 DocumentStream
时> 属性,mht
文件的源显示,就像我在记事本中打开该文件一样。
如果我将流写入临时文件然后导航到它,它可以正常工作,但我不想这样做。
这个问题似乎很常见,但我没有找到有效的解决方案。 有些人建议我应该通过实施 < code>IPersistMoniker com 接口,...等。我尝试过一点,但不幸的是我得到了相同的结果。也许我做错了什么。我仍然觉得他们应该是一个更直接的解决方案(除了先保存在临时文件中),有什么想法吗?
The WebBrowser control loads properly any mht
file if I use the Navigate
method, but when I use the DocumentText
or DocumentStream
properties, the source of the mht
file is displayed as if I opened the file in notepad.
If I write the stream to a temp file then Navigate to it, it works properly, but I don't want to do it this way.
This issue seems common, but I didn't find a working solution for it. Some people suggest I should fool IE by implementing IPersistMoniker
com interface, ...etc. I have tried with this a little bit, but unfortunately I got the same result. May be I have done something wrong. I still feel their should be a more straightforward solution (other than saving in a temp file first), any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我记得几年前我也遇到过同样的问题,尽管我寻找解决方案,但没有找到任何解决方案。最后,我采用了临时文件方法。祝你好运,如果有答案我也想知道。
I remember I was facing the same issue a few years ago and although I searched for a solution then I did not find any. In the end, I went for the temp-file approach. I wish you good luck, and if there's an answer I would like to know too.
在vb.net中我们使用过
问题是只有IE似乎接受它。
in vb.net we've used
Problem is only IE seems to accept it.
其中 source - .mht 文件的路径
where source - path to your .mht file