Solved

Load text into TwebBrowser

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 331
add combobox item based on numbers 9 141
Delphi XE10 Round Image 2 121
Delphi: making a BW image transparent 10 37
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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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