![]() |
Webseite verändern und dann speichern
Hi!
Ich habe ein Problem: Ich habe im IE einen neuen Button hinzugefügt, der Text ausschneiden kann:
Delphi-Quellcode:
Der Text wird also nicht kopiert sondern effektiv ausgeschnitten.
try
WebBrowser.ExecWB(OLECMDID_CUT, OLECMDEXECOPT_PROMPTUSER, EmptyParam, EmptyParam); except end; Natürlich will ich die Änderung auch speichern, aber es funktioniert nicht:
Delphi-Quellcode:
Die Webseite wird unverändert gespeichert...
function GetHTMLCode(WB: IWebbrowser2): Boolean;
var ps: IPersistStreamInit; s: string; ss: TStringStream; sa: IStream; ACode: TStrings; filename: String; begin ps := WB.document as IPersistStreamInit; s := ''; ss := TStringStream.Create(s); ACOde:=TStringList.Create; try sa:= TStreamAdapter.Create(ss, soReference) as IStream; Result := Succeeded(ps.Save(sa, Bool(True))); if Result then ACode.Add(ss.Datastring); filename:=copy(wb.locationurl,9,length(wb.LocationURL)-8); Filename:=stringreplace(filename,'%20', ' ',[rfReplaceAll]); Acode.SaveToFile(filename); finally ss.Free; ACode.Free; end; end; Wo liegt mein Fehler? Ciao Frederic |
Re: Webseite verändern und dann speichern
Hallo,
ich hab jetzt Deinen Code nicht getestet. Bei meinen Versuchen mit
Delphi-Quellcode:
hat es auch nicht funktioniert, da holt er wohl den HTML-Code aus dem Cache!?
(WebBrowser1.Document as IPersistFile).Save('c:\temp\test.html', True);
Versuch mal das, bei mir funktioniert es:
Delphi-Quellcode:
var sL : TStringList;
begin sL := TStringList.Create; try sL.Text := WebBrowser1.OleObject.Document.Body.InnerHtml; sL.SaveToFile('c:\temp\test.html'); finally sL.Free; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:05 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz