Writing the text after converting the html into the text form

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.

1 Like

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

1 Like

@rohit_agr, Check this,

Regards,
Dom :slight_smile:

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.

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

how to convert the html code into text and without missing any alignment and styles (for example bold, bullet,colours and fonts) ? could any one help me on this ???

1 Like

hello @VennuSantosh, did you resolve this?

this doesn’t work when there are images involved in the emails or the whole body is an image.

Try “Extract Text” activity