HtmlUtilities.ConvertToText(String) Method

Definition

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

public:
 static Platform::String ^ ConvertToText(Platform::String ^ html);
 static winrt::hstring ConvertToText(winrt::hstring const& html);
public static string ConvertToText(string html);
function convertToText(html)
Public Shared Function ConvertToText (html As String) As String

Parameters

html
String

A String containing HTML-formatted data.

Returns

String

A String of text content.

Remarks

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.

Applies to