exporting HTML saved in sql server to word in asp.net MVC application

%3CLINGO-SUB%20id%3D%22lingo-sub-3021069%22%20slang%3D%22en-US%22%3Eexporting%20HTML%20saved%20in%20sql%20server%20to%20word%20in%20asp.net%20MVC%20application%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3021069%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20web%20application%20developed%20using%20ASP.NET%20MVC%2C%20C%23%2C%20entity%20framework%20and%20SQL%20Server.%20I%20am%20using%20a%20rich%20editor%20to%20save%20HTML%20in%20SQL%20Server.%20I%20am%20able%20to%20render%20the%20saved%20html%20to%20webpage%20correctly%20using%20HTML.Raw%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%20%40Html.Raw(item.TitleContent)%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EBut%20when%20I%20try%20to%20export%20this%20HTML%20retrieved%20using%20entity%20framework%20in%20my%20controller%20class%20to%20word%20document%2C%20the%20HTML%20formatting%20is%20getting%20messed%20up.%20Is%20there%20any%20HTML.Raw%20equivalent%20which%20I%20can%20use%20in%20my%20controller%20class%3F%3C%2FP%3E%3CP%3EThanks.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3021069%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Emvc%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

I have a web application developed using ASP.NET MVC, C#, entity framework and SQL Server. I am using a rich editor to save HTML in SQL Server. I am able to render the saved html to webpage correctly using HTML.Raw

<p> @Html.Raw(item.TitleContent)</p>

But when I try to export this HTML retrieved using entity framework in my controller class to word document, the HTML formatting is getting messed up. Is there any HTML.Raw equivalent which I can use in my controller class?

Thanks. 

 

1 Reply

@Gurpreet786 You may need to decode it, like this: HttpUtility.HtmlDecode(your content);