Autor Beitrag
fablio
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

WIN XP
D7 Ent
BeitragVerfasst: Do 24.07.03 15:30 
Hi

Ich habe eine Memo-Komponente mit HTML-Code und möchte diesen in der WebBrowser-Komponente anzeigen.
ausblenden Quelltext
1:
WebBrowser1. ? := Memo1.Text;					


mfg

_________________
Der Optimist hofft, alles werde beim alten bleiben; der Pessimist befürchtet dies.
W. Saroyan
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Do 24.07.03 15:32 
geht so nicht.
Memo.lines.savetoFile() und dann WebBrowser.Navigate().
grez
msch
ao
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 145

Win XP Prof.
D7 Ent.
BeitragVerfasst: Do 24.07.03 15:48 
geht so doch.

uses-klausel erweitern:
ausblenden Delphi-Quelltext
1:
uses {...} SHDocVw, ActiveX;					


folgende prozedur einbauen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
procedure TForm1.WB_LoadHTML(WebBrowser: TWebBrowser; HTMLCode: string);
var 
  sl: TStringList; 
  ms: TMemoryStream; 
begin 
  WebBrowser.Navigate('about:blank'); 
  while WebBrowser.ReadyState < READYSTATE_INTERACTIVE do 
    Application.ProcessMessages;
  if Assigned(WebBrowser.Document) then
  begin 
    sl := TStringList.Create; 
    try 
      ms := TMemoryStream.Create; 
      try 
        sl.Text := HTMLCode; 
        sl.SaveToStream(ms); 
        ms.Seek(00); 
        (WebBrowser.Document as IPersistStreamInit).Load(TStreamAdapter.Create(ms));
      finally 
        ms.Free; 
      end
    finally 
      sl.Free; 
    end
  end;
end;


und so aufrufen:
ausblenden Delphi-Quelltext
1:
WB_LoadHTML(WebBrowser1, Memo1.Text);					


müsste so gehen ...

gruss
andreas
fablio Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

WIN XP
D7 Ent
BeitragVerfasst: Fr 25.07.03 12:11 
funktioniert perfekt Danke!

_________________
Der Optimist hofft, alles werde beim alten bleiben; der Pessimist befürchtet dies.
W. Saroyan