(Delphi ActiveX) Convert HTML to plain-text
Demonstrates how to convert HTML to plain-text.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
h2t: THtmlToText;
html: WideString;
plainText: WideString;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
h2t := THtmlToText.Create(Self);
// Set the HTML:
html := '<html><body><p>This is a test.</p><blockquote>Here is text within a blockquote</blockquote></body></html>';
plainText := h2t.ToText(html);
Memo1.Lines.Add(plainText);
// The output looks like this:
// This is a test.
//
// Here is text within a blockquote
end;
|