Writing the text after converting the html into the text form

uiautomation

#1

Hi,
I am getting the html code stored in the variable of string type. Now I want to write the text obtained in normal form(removing the tags) in the file.
Any suggestions.


#2

Hi @rohit_agr,

System.Text.RegularExpressions.Regex.Replace(HTMLCode, "<[^>]*>", "")

Refer this link
http://www.beansoftware.com/ASP.NET-Tutorials/Convert-HTML-To-Plain-Text.aspx

Regards,
Arivu


#3

@rohit_agr, Check this,

Regards,
Dom :slight_smile:


#4

Thanks @arivu96
I tried for this, It works for the tag fine but the CSS part still remain there. Any suggestions through which CSS can also be removed.


#5

Hi @rohit_agr,

Try this way

Split the string using<body>

use the second value to get the value.

StrValue=StrValue.Split(new string[] { "<body>" }, StringSplitOptions.None)(1)

Regards,

Arivu