Solved

Load text into TwebBrowser

Posted on 2002-03-24
3
212 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 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

11 Experts available now in Live!

Get 1:1 Help Now