Keep a HTM file for MHT file
Such as
the C: \ 1. HTM file to C: \ 2. MHT file
note that 1. HTM file with pictures inside the
Is the most important function of the image file is written to the 2. MHT file if using an absolute path failed
Keep a HTM file for MHT file this wizHtmlEditor can do
The following code is to use DELPHI implementation save HTM for MHT file but can't realize my this requirement
Implementation
USES ADODB_TLB, CDO_TLB ComObj;
{$R *. DFM}
Procedure WB_SaveAs_MHT (WB: TWebBrowser; FileName: TFileName);
Var
Msg: called IMessage --;
The Conf: IConfiguration;
Stream: _Stream;
URL: widestring;
The begin
If not Assigned (WB) Document) then the Exit;
URL:=WB. LocationURL;
Msg:=CoMessage. Create;
The Conf:=CoConfiguration. Create;
Try
Msg. The Configuration:=Conf;
Msg. CreateMHTMLBody (URL, cdoSuppressImages, ' ', ');//cdoSuppressNone cdoSuppressImages, cdoSuppressAll
Stream:=Msg. GetStream;
Stream. SaveToFile (FileName, adSaveCreateOverWrite);
The finally
Msg:=nil;
The Conf:=nil;
Stream:=nil;
end;
end; WB_SaveAs_MHT (* *)
Procedure TForm1. Button1Click (Sender: TObject);
Var
F: string;
The begin
F:=ExtractFilePath (Application. ExeName) + 'WebDoc. HTM';
Webbrowser1. Navigate (f);
end;
Procedure TForm1. Button2Click (Sender: TObject);
Var
F1: string;
The begin
F1:=ExtractFilePath (Application. ExeName) + '1. MHT';
WB_SaveAs_MHT (webbrowser1, f1);
end;
It save the pictures is still an absolute path as shown in figure
this is meaninglessAfter repeated testing cdoSuppressNone cdoSuppressImages, cdoSuppressAll modified into one of the three can realize the following function
The WIZ is saved into the
Here more than a MHTML and cid the BBBBB. The MHT file is copied to the other people's computer is on picture is not lost
This is the MHT file using notepad to open the