UtilHtmlAgilityPackStripHtml Method
Removes HTML tags from an html string and returns the content in plain text format.
Namespace: DevCase.ThirdParty.HtmlAgilityPackAssembly: DevCase.net48.ThirdParty.HtmlAgilityPack (in DevCase.net48.ThirdParty.HtmlAgilityPack.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static string StripHtml(
string html,
params string[] allowedTags
)
Public Shared Function StripHtml (
html As String,
ParamArray allowedTags As String()
) As String
Dim html As String
Dim allowedTags As String()
Dim returnValue As String
returnValue = UtilHtmlAgilityPack.StripHtml(html,
allowedTags)
public:
static String^ StripHtml(
String^ html,
... array<String^>^ allowedTags
)
static member StripHtml :
html : string *
allowedTags : string[] -> string
No code example is currently available or this language may not be supported.
- html String
-
The string that contains HTML tags.
- allowedTags String
-
An optional list of allowed HTML tags that will not be removed from the string.
String
The resulting plain text content without HTML tags.
Note: Some functionalities of this assembly may require to install one or all of the listed NuGet packages:
This is a code example.
No code example is currently available or this language may not be supported.
Dim html As String =
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%;
FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 9pt">In an
email sent just three days before the Deepwater Horizon exploded, the onshore
<SPAN style="mso-bidi-font-weight: bold"><b>BP</b></SPAN> manager in charge of
the drilling rig warned his supervisor that last-minute procedural changes were
creating "chaos". April emails were given to government investigators by <SPAN
style="mso-bidi-font-weight: bold"><b>BP</b></SPAN> and reviewed by The Wall
Street Journal and are the most direct evidence yet that workers on the rig
were unhappy with the numerous changes, and had voiced their concerns to <SPAN
style="mso-bidi-font-weight: bold"><b>BP</b></SPAN>’s operations managers in
Houston. This raises further questions about whether <SPAN
style="mso-bidi-font-weight: bold"><b>BP</b></SPAN> managers properly
considered the consequences of changes they ordered on the rig, an issue
investigators say contributed to the disaster.</SPAN></p><br/>
.Value
Dim allowedTags As String() = {"span", "b"}
Dim str As String = StripHtml(html, allowedTags)
Console.WriteLine(str)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.