function TBrowser.GetWebBrowserHTML(const WebBrowser: TWebBrowser): string;var LStream: TStringStream; Stream : IStream; LPersistStreamInit : IPersistStreamInit;begin try if not Assigned(WebBrowser.Document) then exit; LStream := TStringStream.Create('', TEncoding.UTF8); try LPersistStreamInit := WebBrowser.Document as IPersistStreamInit; Stream := TStreamAdapter.Create(LStream,soReference); LPersistStreamInit.Save(Stream,true); result := LStream.DataString; finally LStream.Free(); end; except end;end;
关键字词: