remove html tags but keep formatting like bold and italics

Topics: Developer Forum, User Forum
May 13, 2014 at 8:19 PM
is it possible to use the html agility pack to remove the html tags that are being displayed in my pdf and just display the text with the proper formatting? I have an mvc application and I am also using pdf sharp. i have a line of code that is displaying all the html tags included with the text.
here is the code creating the text from the description field :
        graphics.DrawString("" + report.Description, font2, XBrushes.Black, new XRect(margin + 90, page.Height - (lineHeight * 35), page.Width, page.Height), XStringFormats.TopLeft);

here is the publis class model :
    public string Description { get; set; }
and this is what i was using to strip the tags but i dont get any of the proper bolding or italics it is supposed to display:

report.Description = Regex.Replace(report.Description, "<.*?>| ", string.Empty);

any advice or support would be greatly appreciated. i have never used the html agility pack but i had some suggestions to try it and just need some help getting started. please let me no if this is possible.

thank u in advance. and please let me no if you need anymore info.