在C#中将HTML转换为纯文本

问题描述:

我正在使用HTML内容。我如何将其转换为纯文本,以便我可以在标签中进行。



任何建议!!!

I am having HTML content. How can i convert it into plain text so that i can so it in a label.

Any suggestion !!!

您可以使用 Html Agility Pack [ ^ ],这是一个用于.NET的HTML解析器。其中一个示例显示了如何将HTML转换为纯文本:

http:/ /htmlagilitypack.codeplex.com/sourcecontrol/changeset/view/62772#52179 [ ^ ]
You can use the Html Agility Pack[^], a HTML parser for .NET, for this. One of their samples shows how to convert HTML to plain text:
http://htmlagilitypack.codeplex.com/sourcecontrol/changeset/view/62772#52179[^]