 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Barton Stano Guest
|
Posted: Mon Apr 24, 2006 4:03 pm Post subject: HTML to text |
|
|
I am looking for a already done object for Delphi 2005/2006 that converts
HTML formated e-mail bodies to the raw text, it just removes the HTML
formatting codes. Anybody have any idea? It can be shareware or commerical.
If you recommend something, please give me an idea why it is great and any
known drawbacks on it. Thanks in advance! |
|
| Back to top |
|
 |
JEM Guest
|
Posted: Mon Apr 24, 2006 4:03 pm Post subject: Re: HTML to text |
|
|
| Quote: | I am looking for a already done object for Delphi 2005/2006 that converts
HTML formated e-mail bodies to the raw text, it just removes the HTML
formatting codes. Anybody have any idea? It can be shareware or
commerical.
If you recommend something, please give me an idea why it is great and any
known drawbacks on it. Thanks in advance!
|
www.compnet101.com/atagparser
will do it easily.
I'll even show you how..
John McTaggart |
|
| Back to top |
|
 |
Mike Shkolnik Guest
|
Posted: Mon Apr 24, 2006 10:03 pm Post subject: Re: HTML to text |
|
|
See the sample code:
http://www.scalabium.com/faq/dct0162.htm
--
With best regards, Mike Shkolnik
E-mail: mshkolnik (AT) scalabium (DOT) com
WEB: http://www.scalabium.com
"Barton Stano" <bart (AT) publishorperish (DOT) com> wrote in message
news:444ce9a4$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I am looking for a already done object for Delphi 2005/2006 that converts
HTML formated e-mail bodies to the raw text, it just removes the HTML
formatting codes. Anybody have any idea? It can be shareware or
commerical.
If you recommend something, please give me an idea why it is great and any
known drawbacks on it. Thanks in advance!
|
|
|
| Back to top |
|
 |
Craig Guest
|
Posted: Tue Apr 25, 2006 12:03 am Post subject: Re: HTML to text |
|
|
| Quote: | I am looking for a already done object for Delphi 2005/2006 that converts
HTML formated e-mail bodies to the raw text, it just removes the HTML
formatting codes. Anybody have any idea? It can be shareware or commerical.
If you recommend something, please give me an idea why it is great and any
known drawbacks on it. Thanks in advance!
|
Try
function HtmlToText(const Html: string): string;
var
WebBrowser: TWebBrowser;
Document: IHtmlDocument2;
Doc: OleVariant;
v: Variant;
Body: IHTMLBodyElement;
TextRange: IHTMLTxtRange;
begin
Result := '';
WebBrowser := TWebBrowser.Create(nil);
try
Doc := 'about:blank';
WebBrowser.Navigate2(Doc);
Document := WebBrowser.Document as IHtmlDocument2;
if (Assigned(Document)) then
begin
v := VarArrayCreate([0, 0], varVariant);
v[0] := Html;
Document.Write(PSafeArray(TVarData(v).VArray));
Document.Close;
Body := Document.body as IHTMLBodyElement;
TextRange := Body.createTextRange;
Result := TextRange.text;
end;
finally
WebBrowser.Free;
end;
end; |
|
| Back to top |
|
 |
Ralf Junker - http://www. Guest
|
Posted: Tue Apr 25, 2006 10:03 am Post subject: Re: HTML to text |
|
|
| Quote: | I am looking for a already done object for Delphi 2005/2006 that converts
HTML formated e-mail bodies to the raw text, it just removes the HTML
formatting codes. Anybody have any idea? It can be shareware or commerical.
If you recommend something, please give me an idea why it is great and any
known drawbacks on it. Thanks in advance!
|
Hi Barton,
DIHtmlParser: http://www.yunqa.de/delphi/htmlparser/
will do this easily, with full Unicode support (accented & foreign language
characters) as well.
DIHtmlParser is great because it is fast, uses minimal memory, processes all
HTML you throw at it, deals with international languages, and does all this
fully natively: You do not need to have IE nor additional character sets
installed on your client's system.
The DIHtmlParser_ExtractText demo project even shows you how to go about when
extracting text from HTML.
Regards,
Ralf
---
The Delphi Inspiration
http://www.yunqa.de/delphi/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|