var
Form1: TForm1;
CurDispatch: IDispatch;
implementation
{$R *.dfm}
procedure TForm1.WebBrowser1NavigateComplete2(Sender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
begin
if CurDispatch =
nil then CurDispatch := pDisp;
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
begin
if (pDisp = CurDispatch)
then
begin
RichEditWB1.LoadHTMLFromBrowser;
RichEdit1.Lines.Text := RichEditwb1.Lines.Text ;
RichEdit1.PlainText := true;
RichEdit1.Lines.SaveToFile('
d:\text_del6\user.txt');
RichEdit1.Clear;
CurDispatch :=
nil;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.ActiveControl := EmBeddedWB1;
EmbeddedWb1.Navigate('
d:\text_del6\user.html');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
inhalt: TStringlist;
tag1, tag2:
String;
i,p,x : Integer;
s:
String;
begin
inhalt := TStringlist.Create;
inhalt.LoadFromFile('
d:\text_del6\user.txt');
tag1 := '
<TD align=middle>';
tag2 := '
</TD>';
for i := 0
to inhalt.Count - 1
do
begin
if pos(tag1, inhalt[i]) > 0
then
begin
s := '
';
for p := pos(tag1, inhalt[i])
to length(inhalt[i])
do
if inhalt[i][p] <> s
then
s := s + inhalt[i][p]
else
break;
while pos(s[length(s)], tag2) = 0
do
delete(s, length(s), 1);
RichEdit1.Lines.Add(s);
end;
end;
inhalt.Free;
for x := 0
to RichEdit1.Lines.Count - 1
do
begin
RichEdit1.Lines.Delete(1);
end;
RichEdit1.Lines.Text := StringReplace(RichEdit1.Lines.Text, '
<TD align=middle>', '
', [rfReplaceAll, rfignorecase]);
RichEdit1.Lines.Text := StringReplace(RichEdit1.Lines.Text, '
</TD>', '
', [rfReplaceAll, rfignorecase]);
deleteFile('
d:\text_del6\user.txt');
end;