Save TIpHTMLPanel Content lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Fahmy Rofiq · 2013-03-31 07:00 How to save TIpHTMLPanel (TurboPowerIPro) loaded url content to a file or stream? Thanks. ---------------------------------------------------------------------- howardpc · 2013-03-31 17:42 The following is a bit of a hack using the clipboard to save writing code, but if you drop a button and TipHtmlPanel on a form and add the following code, you can save the panel's HTML to a file (or stream if you adapt the idea). Code: [Select]unit uMain; {$mode objfpc}{$H+} interface uses Classes, IpHtml, Forms, StdCtrls; type TForm1 = class(TForm) BSave: TButton; IpHtmlPanel1: TIpHtmlPanel; procedure BSaveClick(Sender: TObject); procedure FormCreate(Sender: TObject); public procedure SaveHTMLPanelToFile(ipPnl: TIpHtmlPanel; aFileName: string); end; var Form1: TForm1; implementation uses Clipbrd; {$R *.lfm} procedure TForm1.FormCreate(Sender: TObject); begin IpHtmlPanel1.SetHtmlFromStr( '
Example bold html text for IpHtmlPanel link.html (though this link is missing so it does not '+ 'work as a link).'); end; procedure TForm1.BSaveClick(Sender: TObject); begin SaveHTMLPanelToFile(IpHtmlPanel1, 'test.html'); end; procedure TForm1.SaveHTMLPanelToFile(ipPnl: TIpHtmlPanel; aFileName: string); var sl: TStringList; begin ipPnl.CopyToClipboard; sl:= TStringList.Create; try sl.Text := clipboard.AsText; sl.SaveToFile(aFileName); finally sl.Free; end; end; end.