Sample code for 30+ languages & platforms
C#

Convert HTML to Plain Text

Demonstrates how to convert HTML to plain text.

Chilkat C# Downloads

C#
//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

Chilkat.HtmlToText h2t = new Chilkat.HtmlToText();

string html = h2t.ReadFileToString("c:/temp/test.html","utf-8");
if (h2t.LastMethodSuccess == false) {
    Debug.WriteLine(h2t.LastErrorText);
    return;
}

string plainText = h2t.ToText(html);
if (h2t.LastMethodSuccess == false) {
    Debug.WriteLine(h2t.LastErrorText);
    return;
}

Debug.WriteLine(plainText);