SPHttpUtility.ConvertSimpleHtmlToText Method

Converts an HTML string from a Microsoft SharePoint Foundation rich text field to plain text.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Function ConvertSimpleHtmlToText ( _
    html As String, _
    maxLength As Integer _
) As String
'Usage
Dim html As String
Dim maxLength As Integer
Dim returnValue As String

returnValue = SPHttpUtility.ConvertSimpleHtmlToText(html, _
    maxLength)
public static string ConvertSimpleHtmlToText(
    string html,
    int maxLength
)

Parameters

  • html
    Type: System.String

    An HTML string that contains the contents of a Microsoft SharePoint Foundation rich text field.

  • maxLength
    Type: System.Int32

    A 32-bit integer representing the maximum desired length of the returned string, or -1 to specify no maximum length.

Return Value

Type: System.String
A plain text string version of the string.

Remarks

The ConvertSimpleHtmlToText method has unspecified behavior if the input string is not a value from a Microsoft SharePoint Foundation rich text field.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

Microsoft.SharePoint.Utilities Namespace