Wednesday, January 26, 2005

 

Some notes on SaveAs MHTML

正好被人问及这个问题,所以讨论一下

首先,当然是看微软得相关文档

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_mime_encapsulation_of_aggregate_html_documents_mhtml_.asp

如果是VC操作IE,则可以参见

Automated IE SaveAs MHTML
By Stephane Rodriguez.
http://www.codeproject.com/shell/iesaveas.asp

Save As MHTML (whole web page, images, ... in a single file)
Save As Full HTML (additional folder for images, ...)
Save HTML code only
Save As Text
等几个功能都实现了,很不错得文章

如果是ASP.Net,则可以看

Convert HTML to MHTML using ASP.NET
By Partenon
http://www.codeproject.com/aspnet/aspnethtml2mht.asp
代码很简单直白。

得到的文件可以打成二进制包放进数据库,这个比较简单,不多说。

当然,对于某些网页,上述方法还是可能有些问题。基本上是“it flashed some scripting errors And unable to load and show some .gif images.”这两个原因造成的。前一个问题可以用Edit模式解决,后一个问题不知那位高手有办法。



<< Home

This page is powered by Blogger. Isn't yours?