2005. december 28., szerda

Append HTML Text to a TWebbrowser Document

Problem/Question/Abstract:

How to append HTML Text to a TWebbrowser Document?

Answer:

uses
MSHTML;

procedure TForm1.Button1Click(Sender: TObject);
var
Range: IHTMLTxtRange;
begin
Range := ((WebBrowser1.Document as IHTMLDocument2).body as
IHTMLBodyElement).createTextRange;
Range.collapse(False);
Range.pasteHTML('<br><b>Hello!</b>');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Webbrowser1.Navigate('www.google.ch');
end;


Nincsenek megjegyzések:

Megjegyzés küldése