0

How do i parse html content stored in database in web form application? For instance: I have a column in table that stores the content like this:

<b>Hello</b><i>World</i>

I need to retrieve the content and save to word document. So, how can i get the string text equivalent to: Hello World

4
  • What have you done so far? you can use HTML Renderer for the same. Commented Dec 16, 2016 at 4:16
  • i tried html agility pack. but it seems like it works while loading from a site with a url like this: var web = new HtmlWeb(); var doc = web.Load(url); This way it returns a HtmlDocument object. Commented Dec 16, 2016 at 4:20
  • check if the below stack overflow post helps you. stackoverflow.com/questions/2363993/… Commented Dec 16, 2016 at 4:23
  • hi kalyana unfortunately the solution in the link only works with office interop. I am unable to use that. Commented Dec 16, 2016 at 4:32

1 Answer 1

0

f the string is encoded in your database, then you need to call WebUtility.HtmlDecode:

@Html.Raw(WebUtility.HtmlDecode(someString))
Sign up to request clarification or add additional context in comments.

2 Comments

Hi will this work with Web forms? I am not using mvc.
How about reference this link : stackoverflow.com/questions/5314951/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.