首页 > 代码库 > delphi 保存网页MHT
delphi 保存网页MHT
delphi 保存网页MHT
<style></style><style></style><script id="wiz_todo_script_id" charset="utf-8" type="text/javascript" src="file:///D:\Program Files\Wiz\WizTools\htmleditor\todo.js"></script><script id="wiz_img_resize_script_id" charset="utf-8" type="text/javascript" src="file://D:\Program Files\Wiz\WizTools\htmleditor\dragresize.js"></script><style></style>
procedure WB_SaveAs_MHT(WB: TWebBrowser; FileName: TFileName); var Msg: IMessage; Conf: IConfiguration; Stream: _Stream; URL: Widestring; begin if not Assigned(WB.Document) then Exit; URL := WB.LocationURL; Msg := CoMessage.Create; Conf := CoConfiguration.Create; try Msg.Configuration := Conf; Msg.CreateMHTMLBody(URL, cdoSuppressNone, ‘‘, ‘‘); Stream := Msg.GetStream; Stream.SaveToFile(FileName, adSaveCreateOverWrite); finally Msg := nil; Conf := nil; Stream := nil; end; end; (* WB_SaveAs_MHT *) |
procedure TForm1.FormCreate(Sender: TObject); var f: string; begin f := ExtractFilePath(Application.ExeName) + ‘WebDoc.htm‘; WebBrowser1.Navigate(‘file:///C:\Users\Admin\Desktop\新建文件夹\WebDoc.htm‘); end; |
procedure TForm1.Button1Click(Sender: TObject); begin WB_SaveAs_MHT(WebBrowser1,‘C:\Users\Admin\Desktop\11.mht‘); end; |
ADODB_TLB.pas
CDO_TLB.pas
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。