(Delphi DLL) 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, HtmlToText;
...
procedure TForm1.Button1Click(Sender: TObject);
var
h2t: HCkHtmlToText;
html: PWideChar;
plainText: PWideChar;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
h2t := CkHtmlToText_Create();
// Set the HTML:
html := '<html><body><p>This is a test.</p><blockquote>Here is text within a blockquote</blockquote></body></html>';
plainText := CkHtmlToText__toText(h2t,html);
Memo1.Lines.Add(plainText);
// The output looks like this:
// This is a test.
//
// Here is text within a blockquote
CkHtmlToText_Dispose(h2t);
end;
|