很简单牙.<br>procedure TForm1.SaveHTMLSourceToFile(const FileName: string; <br> WB: TWebBrowser); <br>var <br> PersistStream: IPersistStreamInit; <br> FileStream: TFileStream; <br> Stream: IStream; <br> SaveResult: HRESULT; <br>begin <br> PersistStream := WB.Document as IPersistStreamInit; <br> FileStream := TFileStream.Create(FileName, fmCreate); <br> try <br> Stream := TStreamAdapter.Create(FileStream, soReference) as IStream; <br> SaveResult := PersistStream.Save(Stream, True); <br> if FAILED(SaveResult) then <br> MessageBox(Handle, 'Fail to save HTML source', 'Error', 0); <br> finally <br> { we are passing soReference in TStreamAdapter constructor, <br> it is our responsibility to destroy the TFileStream object. } <br> FileStream.Free; <br> end; <br>end; <br><br>pocedure TForm1.Button1Click(Sender: TObject); <br>begin <br> if SaveDialog1.Execute then <br> SaveHTMLSourceToFile(SaveDialog1.FileName, WebBrowser1); <br>end; <br>