1.C# webbrowser ä¿åhtmlåå¾ç
C# webbrowser ä¿åhtmlåå¾ç
æ¯è¦è·å带å¾ççè±æºHTMLæ件å§ï¼å¦ææ¯çè¯å¯ä»¥ç¨ä¸é¢çæ¹æ³
//urlæ¯è¦ä¿åçç½é¡µå°å
//filePathæ¯ä¿åå°çæ件路å¾
public static bool SaveWebPageToMHTFile(string url,怎样查看食品的溯源码查询 string filePath)
{
bool result = false;
CDO.Message msg = new CDO.MessageClass();
ADODB.Stream stm = null;
try
{
msg.MimeFormatted = true;
msg.CreateMHTMLBody(url, CDO.CdoMHTMLFlags.cdoSuppressNone, "", ""); stm = msg.GetStream();
stm.SaveToFile(filePath, ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
msg = null;
stm.Close();
result = true;
}
catch
{ throw; }
finally
{
//cleanup here
}
return result;
}