Solved

Load text into TwebBrowser

Posted on 2002-03-24
3
213 Views
Last Modified: 2010-04-05
I have a string list containing some HTML text and I would like to display it in a TwebBrowser component. I want a way of doing this without writing the string list to a file and then opening the file with the webBrowser's exec method. Can I somehow use the wbeBrowser's .Document property?

Thanks - Dan
0
Comment
Question by:seabear
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 6893192
hi,
this tests ok:

procedure TForm1.Button1Click(Sender: TObject);
var
mystr : tstringlist;
begin
mystr := tstringlist.create;
mystr.add('<b>hello</b>');
mystr.add('<br>');
mystr.add('<i>hello</i>');
WebBrowser1.Navigate('about:'+mystr.Text);
mystr.free;
end;
0
 
LVL 17

Expert Comment

by:inthe
ID: 6893196
or if you have a stream:

uses activex;

procedure TForm1.Button1Click(Sender: TObject);
var
  ms : TMemoryStream;
begin
    webBrowser1.navigate('about:blank');
    while webBrowser1.busy do
          application.processMessages;
    ms := TMemoryStream.create;
    memo1.lines.saveToStream(ms);
    ms.seek(0, 0);
    (webBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(ms));
    ms.free;
end;
0
 

Author Comment

by:seabear
ID: 6893230
Thanks inThe - that does just what I need - Dan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now