Solved

Load text into TwebBrowser

Posted on 2002-03-24
3
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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