Chilkat C# HtmlToText Class Reference

HtmlToText

HTML to plain-text conversion component. The internal conversion process is much more sophisticated than can be accomplished with the simple regular-expression freeware codes found in the Internet. This is more than simply removing HTML tags from an HTML document.

Properties

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

Error information in plain-text format for the last method called.

public string LastErrorXml {get; }

Error information in XML format for the last method called.

Methods

public bool IsUnlocked();

Returns true if the component is already unlocked. Otherwise returns false.

public string ReadFileToString(string filename, string srcCharset);

Convenience method for reading a text file into a string. The character encoding of the text file is specified by srcCharset. Valid values, such as "iso-8895-1" or "utf-8" are listed at: List of Charsets.

Returns a null on failure

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.

public string ToText(string html);

Converts HTML to plain-text.

Returns a null on failure

public bool UnlockComponent(string code);

Unlocks the component. An arbitrary unlock code may be passed to automatically begin a 30-day trial.

This class is included with the Chilkat HTML-to-XML conversion component license. A permanent unlock code for Chilkat HTML-to-XML should be used to unlock this object.

public bool WriteStringToFile(string stringToWrite, string filename, string outpuCharset);

Convenience method for saving a string to a file. The character encoding of the output text file is specified by outpuCharset (the string is converted to this charset when writing). Valid values, such as "iso-8895-1" or "utf-8" are listed at: List of Charsets.