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

user3399326
  • 863
  • 4
  • 13
  • 24
  • What have you done so far? you can use [HTML Renderer](http://htmlrenderer.codeplex.com/) for the same. – Mohit S Dec 16 '16 at 04: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. – user3399326 Dec 16 '16 at 04:20
  • check if the below stack overflow post helps you. http://stackoverflow.com/questions/2363993/adding-html-text-to-word-using-interop – Kalyan Dec 16 '16 at 04:23
  • hi kalyana unfortunately the solution in the link only works with office interop. I am unable to use that. – user3399326 Dec 16 '16 at 04:32

1 Answers1

0

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

@Html.Raw(WebUtility.HtmlDecode(someString))
Rai Vu
  • 1,595
  • 1
  • 20
  • 30