[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Load text into TwebBrowser

Posted on 2002-03-24
3
Medium Priority
?
220 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 800 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

650 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