HtmlUtilities HtmlUtilities HtmlUtilities HtmlUtilities Class


Provides utility methods for use with HTML-formatted data.

public : static class HtmlUtilities
static struct winrt::Windows::Data::Html::HtmlUtilities
public static class HtmlUtilities
Public Static Class HtmlUtilities
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)



This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).


ConvertToText(String) ConvertToText(String) ConvertToText(String) ConvertToText(String)

Converts HTML-formatted data to a string that contains the text content extracted from the HTML.

public : static Platform::String ConvertToText(Platform::String html)
winrt::hstring ConvertToText(winrt::hstring html) const;
public static string ConvertToText(String html)
Public Static Function ConvertToText(html As String) As string
String String

A String containing HTML-formatted data.

string string

A String of text content.


The ConvertToText method is used to convert HTML-formatted data to a text string. The HTML-formatted data could represent an HTML document or an HTML fragment. When the ConvertToText method parses the HTML-formatted data, no scripts are run and no secondary downloads occur (scripts, images, and stylesheets, for example).

The ConvertToText method will only parse HTML-formatted data to extract the text. If the html parameter contains a non-HTML string (XML or SVG, for example), then the return value will contain an empty string. If the html parameter contains a string that represents an HTML Frameset document, then the return value will contain an empty string.