Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaing formatted HTML

Status
Not open for further replies.

NuWood

Programmer
Mar 14, 2002
44
0
0
GB
Hi

I have a database that contains a field which may well be HTML (the text is from incoming emails).

Within my application I want to display the contents of the field. Which is fine with a dbmemo control. Trouble is it only shows the contents and does not format them as an HTML page.

How can I just take the text and show it as html formatted? Is there a control available to do this? I do not want my users to have to open a browser window or outlook etc...


Any help gratefully recieved


regards
Andrew
 
You could detect that html is inside the memo, and then present the content in a TWebBrowser instead of a TDBMemo control. ;-)

HTH
TonHu
 
Thanks

Great idea but how do i feed a text stream into the TWebBrowser. I don't want to write a file to read it via a URL.....

There has to be a simpler way


 
I don't remember the exact syntax, but I think you can do something like:

WebBrowser1.Document.InnerHTML:=YourString;
 
Hi

Thanks for that but it still shows the HTML it does not interpret it.

Is there a control to utilise the message window in OUTLOOK? This would seem to interpret email based HTML properly.


regards
Andrew
 
NuWood,

I tried the swissdelphi's site code and it works like a charm, what delphi version do you have? also do you have an internet browser installed on the client PC (works only with IE)?

--------------------------------------
What You See Is What You Get
 
Hi

The code worked fine but I only got the html displayed not the web page so it looked just like it does in the dbmemo.

The PC is Win2k with IE6 on it.

This is HTML from an email and is will look like the following

------=_NextPart_001_0045_01C40DAA.C158CC00
Content-Type: multipart/alternative;
boundary="----=_NextPart_002_0046_01C40DAA.C158CC00"


------=_NextPart_002_0046_01C40DAA.C158CC00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Test how attachments are loaded
------=_NextPart_002_0046_01C40DAA.C158CC00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<STYLE>P.msoNormal {
FONT-WEIGHT: normal; FONT-SIZE: 12pt; MARGIN-LEFT: 50px; COLOR: black; =
FONT-FAMILY: "MS Sans Serif", "sans serif"
}
LI.msoNormal {

This is a snippet only of course.

This is the result of sending a very simple HTML email from OUTLOOK but I see the above rather than the content formatted by the HTML

Thanks
 
that is because you are responsible to "filter" out the different message parts from the email. not all of the code is HTML you displayed above. you should only use the part that begins with :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
...

and so on....

--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top